[cfe-commits] r165286 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu Oct 4 18:46:26 PDT 2012


Author: rsmith
Date: Thu Oct  4 20:46:25 2012
New Revision: 165286

URL: http://llvm.org/viewvc/llvm-project?rev=165286&view=rev
Log:
Workaround for libstdc++4.6 <atomic> bug: make comment more explicit about what's going on, per Sean Silva's suggestion.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=165286&r1=165285&r2=165286&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Oct  4 20:46:25 2012
@@ -5407,10 +5407,15 @@
                                             NamespaceDecl *PrevNS) {
   assert(*IsInline != PrevNS->isInline());
 
+  // HACK: Work around a bug in libstdc++4.6's <atomic>, where
+  // std::__atomic[0,1,2] are defined as non-inline namespaces, then reopened as
+  // inline namespaces, with the intention of bringing names into namespace std.
+  //
+  // We support this just well enough to get that case working; this is not
+  // sufficient to support reopening namespaces as inline in general.
   if (*IsInline && II && II->getName().startswith("__atomic") &&
       S.getSourceManager().isInSystemHeader(Loc)) {
-    // libstdc++4.6's <atomic> reopens a non-inline namespace as inline, and
-    // expects that to affect the earlier declaration.
+    // Mark all prior declarations of the namespace as inline.
     for (NamespaceDecl *NS = PrevNS->getMostRecentDecl(); NS;
          NS = NS->getPreviousDecl())
       NS->setInline(*IsInline);





More information about the cfe-commits mailing list