summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-26 22:04:51 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-26 22:04:51 +0000
commit4e4c83e995668562d5341d9e5e73116f285b6f4f (patch)
tree4b8f42b1e2211a4a1fe9790b77784217603dad7c /clang/lib/Serialization/ASTReader.cpp
parent240d20af79cdfe9abd51425c18bbbb06ec072c62 (diff)
downloadbcm5719-llvm-4e4c83e995668562d5341d9e5e73116f285b6f4f.tar.gz
bcm5719-llvm-4e4c83e995668562d5341d9e5e73116f285b6f4f.zip
Teach the ASTReader how to avoid cycles when loading declarations that
are lexically within a particular DeclContext. Test forthcoming. llvm-svn: 138668
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 540b9ef034a..c991cc07764 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud