r176866 - Remove a bogus assert so we don't crash in

Rafael Espindola rafael.espindola at gmail.com
Tue Mar 12 08:06:22 PDT 2013


Author: rafael
Date: Tue Mar 12 10:06:22 2013
New Revision: 176866

URL: http://llvm.org/viewvc/llvm-project?rev=176866&view=rev
Log:
Remove a bogus assert so we don't crash in

namespace {
  struct X {};
}
extern "C" {
  X b = X();
}

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGenCXX/extern-c.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=176866&r1=176865&r2=176866&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Mar 12 10:06:22 2013
@@ -7629,8 +7629,6 @@ GVALinkage ASTContext::GetGVALinkageForV
     TSK = VD->getTemplateSpecializationKind();
 
   Linkage L = VD->getLinkage();
-  assert (!(L == ExternalLinkage && getLangOpts().CPlusPlus &&
-            VD->getType()->getLinkage() == UniqueExternalLinkage));
 
   switch (L) {
   case NoLinkage:

Modified: cfe/trunk/test/CodeGenCXX/extern-c.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/extern-c.cpp?rev=176866&r1=176865&r2=176866&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/extern-c.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/extern-c.cpp Tue Mar 12 10:06:22 2013
@@ -1,16 +1,28 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
 namespace foo {
 
-// RUN: not grep "@a = global i32" %t
+// CHECK-NOT: @a = global i32
 extern "C" int a;
 
-// RUN: not grep "@_ZN3foo1bE = global i32" %t
+// CHECK-NOT: @_ZN3foo1bE = global i32
 extern int b;
 
-// RUN: grep "@_ZN3foo1cE = global i32" %t | count 1
+// CHECK: @_ZN3foo1cE = global i32
 int c = 5;
 
-// RUN: not grep "@_ZN3foo1dE" %t
+// CHECK-NOT: @_ZN3foo1dE
 extern "C" struct d;
 
 }
+
+namespace test1 {
+  namespace {
+    struct X {};
+  }
+  extern "C" {
+    // CHECK: @b = global
+    X b = X();
+  }
+  void *use = &b;
+  // CHECK: @_ZN5test13useE = global
+}





More information about the cfe-commits mailing list