r180583 - Revert r180263. It's causing failures.

Bill Wendling isanbard at gmail.com
Thu Apr 25 16:15:03 PDT 2013


Author: void
Date: Thu Apr 25 18:15:02 2013
New Revision: 180583

URL: http://llvm.org/viewvc/llvm-project?rev=180583&view=rev
Log:
Revert r180263. It's causing failures.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/SemaCXX/undefined-internal.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=180583&r1=180582&r2=180583&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Apr 25 18:15:02 2013
@@ -476,13 +476,6 @@ template <typename T> static bool isInEx
   return First->getDeclContext()->isExternCContext();
 }
 
-static bool isSingleLineExternC(const Decl &D) {
-  if (const LinkageSpecDecl *SD = dyn_cast<LinkageSpecDecl>(D.getDeclContext()))
-    if (SD->getLanguage() == LinkageSpecDecl::lang_c && !SD->hasBraces())
-      return true;
-  return false;
-}
-
 static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
                                               LVComputationKind computation) {
   assert(D->getDeclContext()->getRedeclContext()->isFileContext() &&
@@ -511,8 +504,7 @@ static LinkageInfo getLVForNamespaceScop
         return PrevVar->getLinkageAndVisibility();
 
       if (Var->getStorageClass() != SC_Extern &&
-          Var->getStorageClass() != SC_PrivateExtern &&
-          !isSingleLineExternC(*Var))
+          Var->getStorageClass() != SC_PrivateExtern)
         return LinkageInfo::internal();
     }
 
@@ -1588,8 +1580,11 @@ VarDecl::DefinitionKind VarDecl::isThisD
   //   A declaration directly contained in a linkage-specification is treated
   //   as if it contains the extern specifier for the purpose of determining
   //   the linkage of the declared name and whether it is a definition.
-  if (isSingleLineExternC(*this))
-    return DeclarationOnly;
+  const DeclContext *DC = getDeclContext();
+  if (const LinkageSpecDecl *SD = dyn_cast<LinkageSpecDecl>(DC)) {
+    if (SD->getLanguage() == LinkageSpecDecl::lang_c && !SD->hasBraces())
+      return DeclarationOnly;
+  }
 
   // C99 6.9.2p2:
   //   A declaration of an object that has file scope without an initializer,

Modified: cfe/trunk/test/SemaCXX/undefined-internal.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/undefined-internal.cpp?rev=180583&r1=180582&r2=180583&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/undefined-internal.cpp (original)
+++ cfe/trunk/test/SemaCXX/undefined-internal.cpp Thu Apr 25 18:15:02 2013
@@ -323,10 +323,3 @@ namespace test13 {
   }
 }
 
-namespace test14 {
-  extern "C" const int foo;
-
-  int f() {
-    return foo;
-  }
-}





More information about the cfe-commits mailing list