From b3f4b978bb6e12ec3033323fcac407bc622f4ee6 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 12 Mar 2013 15:06:22 +0000 Subject: [PATCH] Remove a bogus assert so we don't crash in namespace { struct X {}; } extern "C" { X b = X(); } llvm-svn: 176866 --- clang/lib/AST/ASTContext.cpp | 2 -- clang/test/CodeGenCXX/extern-c.cpp | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 0b0da40..b55a926 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -7629,8 +7629,6 @@ GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) { TSK = VD->getTemplateSpecializationKind(); Linkage L = VD->getLinkage(); - assert (!(L == ExternalLinkage && getLangOpts().CPlusPlus && - VD->getType()->getLinkage() == UniqueExternalLinkage)); switch (L) { case NoLinkage: diff --git a/clang/test/CodeGenCXX/extern-c.cpp b/clang/test/CodeGenCXX/extern-c.cpp index ca5cd73..794171b 100644 --- a/clang/test/CodeGenCXX/extern-c.cpp +++ b/clang/test/CodeGenCXX/extern-c.cpp @@ -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 +} -- 2.7.4