summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-09 06:44:17 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-09 06:44:17 +0000
commite74bc0ef4c4b3149c53ae35b5b3ad7fbb1a385c5 (patch)
tree5f566ce71dde4ba27158e41d4a9b527667d530f9 /clang
parent94d3f9dcd0b30add7066bd261746cb149514b2ff (diff)
downloadbcm5719-llvm-e74bc0ef4c4b3149c53ae35b5b3ad7fbb1a385c5.tar.gz
bcm5719-llvm-e74bc0ef4c4b3149c53ae35b5b3ad7fbb1a385c5.zip
[PCH] When loading the decls linked to an identifier, also make them visible
in the translation unit. llvm-svn: 139358
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index e574e25f5b9..1f02d3cf246 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4841,8 +4841,16 @@ ASTReader::SetGloballyVisibleDecls(IdentifierInfo *II,
return;
}
+ ASTContext &Ctx = *getContext();
for (unsigned I = 0, N = DeclIDs.size(); I != N; ++I) {
NamedDecl *D = cast<NamedDecl>(GetDecl(DeclIDs[I]));
+
+ // In C++, translation unit's visible decls map gets emitted in the AST
+ // file, but not on C; make the decl visible so it can be looked up.
+ if (!Ctx.getLangOptions().CPlusPlus)
+ SetExternalVisibleDeclsForName(Ctx.getTranslationUnitDecl(),
+ DeclarationName(II), D);
+
if (SemaObj) {
if (SemaObj->TUScope) {
// Introduce this declaration into the translation-unit scope
OpenPOWER on IntegriCloud