================
@@ -760,8 +787,10 @@ std::unique_ptr<llvm::Module> Interpreter::GenModule() {
   return nullptr;
 }
 
-CodeGenerator *Interpreter::getCodeGen() const {
-  FrontendAction *WrappedAct = Act->getWrapped();
+CodeGenerator *Interpreter::getCodeGen(IncrementalAction *Action) const {
+  if (!Action)
+    Action = Act.get();
+  FrontendAction *WrappedAct = Action->getWrapped();
----------------
anutosh491 wrote:

Hey @vgvassilev ,

Yes I think this makes lot of sense.

1) Reading through the docstring for IncrementalAction I see this 
`
IncrementalAction ensures it keeps its underlying action's objects alive as 
long as the IncrementalParser needs them.`

I think this implies that It’s designed for use with IncrementalParser, and the 
parser is meant to reuse its state. 

2) The parser should not only be responsible for parsing but also for managing 
its respective PTUs. So stuff like registering the PTU, generating module for 
the PTUs should totally be taken care of by 
IncrementalParser/IncrementalCudaDeviceParser.

So the latest comment couples the respective Action to its respective Parser 
(Act to incrparser and DeviceAct to DeviceParser as per point 1.
it also moves the code related to module generation in incrementalParser.

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

Reply via email to