diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/visibility.cpp | 14 |
2 files changed, 15 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); diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp index 6049bf8d2bc..1c4d5bb8e7a 100644 --- a/clang/test/CodeGenCXX/visibility.cpp +++ b/clang/test/CodeGenCXX/visibility.cpp @@ -1295,3 +1295,17 @@ namespace test68 { } // Check lines at top of file. } + +namespace test69 { + // PR18174 + namespace foo { + void f(); + } + namespace foo { + void f() {}; + } + namespace foo __attribute__((visibility("hidden"))) { + } + // CHECK-LABEL: define void @_ZN6test693foo1fEv + // CHECK-HIDDEN-LABEL: define hidden void @_ZN6test693foo1fEv +} |

