aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/DeclBase.h6
-rw-r--r--include/clang/Lex/ModuleLoader.h0
-rw-r--r--lib/Serialization/ASTReader.cpp12
3 files changed, 13 insertions, 5 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 042c50f2a8..8dc15de0f8 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -1322,6 +1322,12 @@ public:
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)
diff --git a/include/clang/Lex/ModuleLoader.h b/include/clang/Lex/ModuleLoader.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/include/clang/Lex/ModuleLoader.h
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 540b9ef034..c991cc0776 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2553,7 +2553,7 @@ namespace {
= static_cast<IdentifierLookupVisitor *>(UserData);
ASTIdentifierLookupTable *IdTable
- = (ASTIdentifierLookupTable *)M.IdentifierLookupTable;
+ = (ASTIdentifierLookupTable *)M.IdentifierLookupTable;
if (!IdTable)
return false;
@@ -2786,7 +2786,7 @@ void ASTReader::setPreprocessor(Preprocessor &pp) {
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);
@@ -4163,6 +4163,7 @@ namespace {
ASTReader &Reader;
const DeclContext *DC;
bool (*isKindWeWant)(Decl::Kind);
+
SmallVectorImpl<Decl*> &Decls;
bool PredefsVisited[NUM_PREDEF_DECL_IDS];
@@ -4204,9 +4205,10 @@ namespace {
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;