[llvm-branch-commits] [cfe-branch] r196745 - Merging r196712:

Bill Wendling isanbard at gmail.com
Sun Dec 8 18:00:10 PST 2013


Author: void
Date: Sun Dec  8 20:00:10 2013
New Revision: 196745

URL: http://llvm.org/viewvc/llvm-project?rev=196745&view=rev
Log:
Merging r196712:
------------------------------------------------------------------------
r196712 | rafael | 2013-12-07 17:13:22 -0800 (Sat, 07 Dec 2013) | 12 lines

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.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/AST/Decl.cpp
    cfe/branches/release_34/test/CodeGenCXX/visibility.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Dec  8 20:00:10 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196153,196189-196192,196198-196199,196206,196208-196209,196211,196215,196359-196362,196370,196387,196423,196454,196456,196459,196488,196532-196533,196535,196538,196588,196630,196658
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196153,196189-196192,196198-196199,196206,196208-196209,196211,196215,196359-196362,196370,196387,196423,196454,196456,196459,196488,196532-196533,196535,196538,196588,196630,196658,196712
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/AST/Decl.cpp?rev=196745&r1=196744&r2=196745&view=diff
==============================================================================
--- cfe/branches/release_34/lib/AST/Decl.cpp (original)
+++ cfe/branches/release_34/lib/AST/Decl.cpp Sun Dec  8 20:00:10 2013
@@ -976,7 +976,7 @@ getExplicitVisibilityAux(const NamedDecl
                            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);

Modified: cfe/branches/release_34/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/CodeGenCXX/visibility.cpp?rev=196745&r1=196744&r2=196745&view=diff
==============================================================================
--- cfe/branches/release_34/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/branches/release_34/test/CodeGenCXX/visibility.cpp Sun Dec  8 20:00:10 2013
@@ -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
+}





More information about the llvm-branch-commits mailing list