summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-12-08 01:13:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-12-08 01:13:22 +0000
commit7ab1ce04bb7f73eaf9e3a990994a7c4edace4fda (patch)
treeb9d80fbaf48a834c5a91e16056058eb6d7386899 /clang/lib
parent1b3dd3527ee717a55641a5fd1a85f7ac6aa1c857 (diff)
downloadbcm5719-llvm-7ab1ce04bb7f73eaf9e3a990994a7c4edace4fda.tar.gz
bcm5719-llvm-7ab1ce04bb7f73eaf9e3a990994a7c4edace4fda.zip
Fix pr18174.
Clang outputs LLVM one top level decl at a time. This combined with the visibility computation code looking for the newest NamespaceDecl would cause it to produce different results for nested namespaces. The two options for producing consistent results are * Delay codegen of anything inside a namespace until the end of the file. * Don't look for the newest NamespaceDecl. This patch implements the second option. This matches the gcc behavior too. llvm-svn: 196712
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Decl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index c75cf20eb38..83f2c53a7c6 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -976,7 +976,7 @@ getExplicitVisibilityAux(const NamedDecl *ND,
kind);
// Use the most recent declaration.
- if (!IsMostRecent) {
+ if (!IsMostRecent && !isa<NamespaceDecl>(ND)) {
const NamedDecl *MostRecent = ND->getMostRecentDecl();
if (MostRecent != ND)
return getExplicitVisibilityAux(MostRecent, kind, true);
OpenPOWER on IntegriCloud