================
@@ -49,6 +51,135 @@ LLVM_INSTANTIATE_REGISTRY(FrontendPluginRegistry)
 
 namespace {
 
+/// Dumps deserialized declarations.
+class DeserializedDeclsLineRangePrinter : public 
DelegatingDeserializationListener, public ASTConsumer {
+public:
+  explicit DeserializedDeclsLineRangePrinter(SourceManager &SM, 
std::unique_ptr<llvm::raw_fd_ostream> OS)
+      : DelegatingDeserializationListener(nullptr, false), SM(SM), 
OS(std::move(OS)) {}
----------------
VitaNuo wrote:

The chain of delegating listeners isn't available at the point where we create 
and register this listener ([this deserial 
listener](https://github.com/VitaNuo/llvm-project/blob/main/clang/lib/Frontend/FrontendAction.cpp#L977)
 is passed through a chain in `BeginSourceFile`, whereas our new listener is 
created and registered in `CreateWrappedASTConsumer`).

However, it seems to me that we can switch inheriting from 
`DelegatingDeserializationListener` to parent `ASTDeserializationListener`. We 
create our own `ASTConsumer`, for which `DeserializedDeclsLineRangePrinter` is 
the only deserialization listener, which IMU means we don't need any chaining. 
On the contrary, the chain of consumers in `BeginSourceFile` is attached to a 
single ASTConsumer, so chaining is inevitable.



https://github.com/llvm/llvm-project/pull/133910
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to