diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-09-17 03:06:44 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-17 03:06:44 +0000 |
| commit | 865c2a7f23de81681f6948b19cddbd36eabf886a (patch) | |
| tree | e18385034eacd9b300c1d2d980de001d80ea980a /clang | |
| parent | ac6271e3f4c8a2afff3abc51d770d8973a22c672 (diff) | |
| download | bcm5719-llvm-865c2a7f23de81681f6948b19cddbd36eabf886a.tar.gz bcm5719-llvm-865c2a7f23de81681f6948b19cddbd36eabf886a.zip | |
PCH: When deserializing an explicit "external definition", don't pass it to HandleTopLevelDecl -- this is already being done inside the reader.
This is something of a hack, since whether the reader actually did this depends on the "isConsumerInterestedIn" predicate. I think we need to rework how this works, but I need to discuss with Doug.
llvm-svn: 82111
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Frontend/PCHReaderDecl.cpp | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index e7321bf6fab..cd08b135471 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -2129,9 +2129,9 @@ void PCHReader::StartTranslationUnit(ASTConsumer *Consumer) { return; for (unsigned I = 0, N = ExternalDefinitions.size(); I != N; ++I) { - Decl *D = GetDecl(ExternalDefinitions[I]); - DeclGroupRef DG(D); - Consumer->HandleTopLevelDecl(DG); + // Force deserialization of this decl, which will cause it to be passed to + // the consumer (or queued). + GetDecl(ExternalDefinitions[I]); } for (unsigned I = 0, N = InterestingDecls.size(); I != N; ++I) { diff --git a/clang/lib/Frontend/PCHReaderDecl.cpp b/clang/lib/Frontend/PCHReaderDecl.cpp index c3c05b0d5da..67ffabba863 100644 --- a/clang/lib/Frontend/PCHReaderDecl.cpp +++ b/clang/lib/Frontend/PCHReaderDecl.cpp @@ -640,6 +640,8 @@ inline void PCHReader::LoadedDecl(unsigned Index, Decl *D) { /// code generation, e.g., inline function definitions, Objective-C /// declarations with metadata, etc. static bool isConsumerInterestedIn(Decl *D) { + if (isa<FileScopeAsmDecl>(D)) + return true; if (VarDecl *Var = dyn_cast<VarDecl>(D)) return Var->isFileVarDecl() && Var->getInit(); if (FunctionDecl *Func = dyn_cast<FunctionDecl>(D)) @@ -794,4 +796,3 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) { return D; } - |

