File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,10 @@ class ASTUnit {
140140 // / LoadFromCommandLine available.
141141 std::shared_ptr<CompilerInvocation> Invocation;
142142
143+ // / Optional owned invocation, just used to keep the invocation alive for the
144+ // / members initialized in transferASTDataFromCompilerInstance.
145+ std::shared_ptr<CompilerInvocation> ModifiedInvocation;
146+
143147 // / Fake module loader: the AST unit doesn't need to load any modules.
144148 TrivialModuleLoader ModuleLoader;
145149
Original file line number Diff line number Diff line change @@ -1501,6 +1501,10 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) {
15011501 Target = &CI.getTarget ();
15021502 Reader = CI.getASTReader ();
15031503 HadModuleLoaderFatalFailure = CI.hadModuleLoaderFatalFailure ();
1504+ if (Invocation != CI.getInvocationPtr ()) {
1505+ // This happens when Parse creates a copy of \c Invocation to modify.
1506+ ModifiedInvocation = CI.getInvocationPtr ();
1507+ }
15041508}
15051509
15061510StringRef ASTUnit::getMainFileName () const {
You can’t perform that action at this time.
0 commit comments