diff options
Diffstat (limited to 'clang/lib/Interpreter/IncrementalParser.cpp')
-rw-r--r-- | clang/lib/Interpreter/IncrementalParser.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/clang/lib/Interpreter/IncrementalParser.cpp b/clang/lib/Interpreter/IncrementalParser.cpp index 5bc8385..ef90fe9 100644 --- a/clang/lib/Interpreter/IncrementalParser.cpp +++ b/clang/lib/Interpreter/IncrementalParser.cpp @@ -387,7 +387,8 @@ std::unique_ptr<llvm::Module> IncrementalParser::GenModule() { void IncrementalParser::CleanUpPTU(PartialTranslationUnit &PTU) { TranslationUnitDecl *MostRecentTU = PTU.TUPart; - if (StoredDeclsMap *Map = MostRecentTU->getPrimaryContext()->getLookupPtr()) { + TranslationUnitDecl *FirstTU = MostRecentTU->getFirstDecl(); + if (StoredDeclsMap *Map = FirstTU->getPrimaryContext()->getLookupPtr()) { for (auto &&[Key, List] : *Map) { DeclContextLookupResult R = List.getLookupResult(); std::vector<NamedDecl *> NamedDeclsToRemove; @@ -406,16 +407,6 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit &PTU) { } } } - - // FIXME: We should de-allocate MostRecentTU - for (Decl *D : MostRecentTU->decls()) { - auto *ND = dyn_cast<NamedDecl>(D); - if (!ND) - continue; - // Check if we need to clean up the IdResolver chain. - if (ND->getDeclName().getFETokenInfo()) - getCI()->getSema().IdResolver.RemoveDecl(ND); - } } llvm::StringRef IncrementalParser::GetMangledName(GlobalDecl GD) const { |