]> granicus.if.org Git - clang/commitdiff
Fix a crash when we were trying to compute the linkage too early.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 May 2013 14:09:46 +0000 (14:09 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 May 2013 14:09:46 +0000 (14:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/CodeGenCXX/mangle.cpp

index f2dda23b4d542f6b029b9b2b13519eebf7b4fd5e..f5e4b42d2769ee5e9dea2c06b81beb727fbcf42a 100644 (file)
@@ -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<CXXRecordDecl>(Tag->getParent()) ||
-      !Tag->isExternallyVisible())
+      !isa<CXXRecordDecl>(Tag->getParent()))
     return;
 
   std::pair<llvm::DenseMap<const DeclContext *, unsigned>::iterator, bool> P =
index e7955a8ed910cb625d6a96f53deef292972463e2..5f31e5480d2affa2d17579d72c198bbf9e4f90be 100644 (file)
@@ -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 <typename T> void func(T) {}
+  void test() { func(foo().a); }
+}
+
+namespace test39 {
+  // CHECK: define internal void @"_ZN6test394funcINS_3$_0Ut_EEEvT_"
+  typedef struct {
+    struct {} a;
+  } *foo;
+  template<typename T> void func(T) {}
+  void test(foo x) {
+    func(x->a);
+  }
+}