================
@@ -1222,6 +1223,9 @@ bool 
ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,
   if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
     return true;
 
+  if (OnCompilerCreated)
+    OnCompilerCreated(*Clang);
----------------
vvuksanovic wrote:

There are a couple of alternatives to that. We should be able to pass the 
`MacroExpansionContext` here instead of the callback function, though that 
exposes that class in `ASTUnit`. Technically, we only need to pass the 
preprocessor instance in the callback.

I agree that exposing the compiler instance this way can allow the callback to 
modify it in some unexpected/problematic way which is not ideal. Looking 
through all parameters of `CreateASTUnitFromCommandLine` I couldn't find any 
option that would allow us to register the `MacroExpansionContext`.

https://github.com/llvm/llvm-project/pull/176126
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to