diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-09 06:44:17 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-09 06:44:17 +0000 |
commit | 84ef0b5f6bd307b1d7cf08cafd68cfcf5facf6e3 (patch) | |
tree | f0da71f9a2727e6cdd0a516ae7dfaba5f55a6718 | |
parent | 45df9c68b4d8eb2206b884c38e89f56d41452c83 (diff) |
[PCH] When loading the decls linked to an identifier, also make them visible
in the translation unit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139358 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index e574e25f5b..1f02d3cf24 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/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 |