From: Rafael Espindola Date: Tue, 28 May 2013 14:09:46 +0000 (+0000) Subject: Fix a crash when we were trying to compute the linkage too early. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bbb0581cb62e019c2b92bdd5362ba93e84e826f;p=clang Fix a crash when we were trying to compute the linkage too early. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182773 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index f2dda23b4d..f5e4b42d27 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -7999,8 +7999,7 @@ size_t ASTContext::getSideTableAllocatedMemory() const { void ASTContext::addUnnamedTag(const TagDecl *Tag) { // FIXME: This mangling should be applied to function local classes too if (!Tag->getName().empty() || Tag->getTypedefNameForAnonDecl() || - !isa(Tag->getParent()) || - !Tag->isExternallyVisible()) + !isa(Tag->getParent())) return; std::pair::iterator, bool> P = diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index e7955a8ed9..5f31e5480d 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -875,3 +875,25 @@ namespace test37 { // CHECK: define void @_Z6ASfuncPU3AS3i void ASfunc(__attribute__((address_space(3))) int* x) {} + +namespace test38 { + // CHECK: define linkonce_odr void @_ZN6test384funcINS_3fooUt_EEEvT_ + typedef struct { + struct { + } a; + } foo; + + template void func(T) {} + void test() { func(foo().a); } +} + +namespace test39 { + // CHECK: define internal void @"_ZN6test394funcINS_3$_0Ut_EEEvT_" + typedef struct { + struct {} a; + } *foo; + template void func(T) {} + void test(foo x) { + func(x->a); + } +}