ExternalVisibleStorage = ES;
}
+ /// \brief Determine whether the given declaration is stored in the list of
+ /// declarations lexically within this context.
+ bool isDeclInLexicalTraversal(const Decl *D) const {
+ return D && (D->NextDeclInContext || D == FirstDecl || D == LastDecl);
+ }
+
static bool classof(const Decl *D);
static bool classof(const DeclContext *D) { return true; }
#define DECL(NAME, BASE)
= static_cast<IdentifierLookupVisitor *>(UserData);
ASTIdentifierLookupTable *IdTable
- = (ASTIdentifierLookupTable *)M.IdentifierLookupTable;
+ = (ASTIdentifierLookupTable *)M.IdentifierLookupTable;
if (!IdTable)
return false;
void ASTReader::InitializeContext(ASTContext &Ctx) {
Context = &Ctx;
assert(Context && "Passed null context!");
-
+
assert(PP && "Forgot to set Preprocessor ?");
PP->getIdentifierTable().setExternalIdentifierLookup(this);
PP->setExternalSource(this);
ASTReader &Reader;
const DeclContext *DC;
bool (*isKindWeWant)(Decl::Kind);
+
SmallVectorImpl<Decl*> &Decls;
bool PredefsVisited[NUM_PREDEF_DECL_IDS];
This->PredefsVisited[ID->second] = true;
}
- Decl *D = This->Reader.GetLocalDecl(M, ID->second);
- assert(D && "Null decl in lexical decls");
- This->Decls.push_back(D);
+ if (Decl *D = This->Reader.GetLocalDecl(M, ID->second)) {
+ if (!This->DC->isDeclInLexicalTraversal(D))
+ This->Decls.push_back(D);
+ }
}
return false;