================
@@ -192,6 +201,32 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl
*MostRecentTU) {
!D->getLangOpts().CPlusPlus)
S.IdResolver.RemoveDecl(ND);
}
+
+ // In C, implicit function declarations are not lexically attached to the
+ // current PTU, so they cannot be found in
+ // MostRecentTU->getPrimaryContext()->getLookupPtr(). We must traverse the
+ // entire IdentifierTable to locate them.
+ // FIXME: Is there a more lightweight solution?
+ llvm::SmallVector<NamedDecl *, 2> NamedDeclsToRemove;
+ if (!S.getLangOpts().CPlusPlus) {
+ for (auto &Entry : S.getASTContext().Idents) {
----------------
vgvassilev wrote:
We should not loop over all of the identifiers. We should do the opposite:
given a named declaration we should check if the name is on the identifier
resolver chain and remove it. What happens when the implicit decl is created?
Does it end up in the same PTU?
https://github.com/llvm/llvm-project/pull/178648
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits