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 @@ -143,6 +143,10 @@ class ASTUnit {
143143 // / Parse available.
144144 std::shared_ptr<CompilerInvocation> CCInvocation;
145145
146+ // / Optional owned invocation, just used to keep the invocation alive for the
147+ // / members initialized in transferASTDataFromCompilerInstance.
148+ std::shared_ptr<CompilerInvocation> ModifiedInvocation;
149+
146150 // / Fake module loader: the AST unit doesn't need to load any modules.
147151 TrivialModuleLoader ModuleLoader;
148152
Original file line number Diff line number Diff line change @@ -1499,6 +1499,10 @@ void ASTUnit::transferASTDataFromCompilerInstance(CompilerInstance &CI) {
14991499 Target = &CI.getTarget ();
15001500 Reader = CI.getASTReader ();
15011501 HadModuleLoaderFatalFailure = CI.hadModuleLoaderFatalFailure ();
1502+ if (Invocation != CI.getInvocationPtr ()) {
1503+ // This happens when Parse creates a copy of \c Invocation to modify.
1504+ ModifiedInvocation = CI.getInvocationPtr ();
1505+ }
15021506}
15031507
15041508StringRef ASTUnit::getMainFileName () const {
You can’t perform that action at this time.
0 commit comments