From: John McCall Date: Tue, 22 Mar 2011 06:58:49 +0000 (+0000) Subject: Fix a test case and teach ClearLinkageCache() to clear the linkage of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78951941f31d3c63c4178a1275e1a2db2e20da11;p=clang Fix a test case and teach ClearLinkageCache() to clear the linkage of a function template decl's pattern, which was suddenly exposed by my last patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128073 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 0dce211c13..df72541fbf 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -639,10 +639,12 @@ void NamedDecl::ClearLinkageCache() { // Clear cached linkage for function template decls, too. if (FunctionTemplateDecl *temp = - dyn_cast(const_cast(this))) + dyn_cast(const_cast(this))) { + temp->getTemplatedDecl()->ClearLinkageCache(); for (FunctionTemplateDecl::spec_iterator i = temp->spec_begin(), e = temp->spec_end(); i != e; ++i) i->ClearLinkageCache(); + } } diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp index dd9ed61434..78749a7a2f 100644 --- a/test/CodeGenCXX/static-init.cpp +++ b/test/CodeGenCXX/static-init.cpp @@ -2,7 +2,7 @@ // CHECK: @_ZZ1hvE1i = internal global i32 0, align 4 -// CHECK: @_ZZN5test16getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 +// CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 // CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0 // CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0 @@ -50,7 +50,7 @@ namespace test0 { } namespace test1 { - // CHECK: define internal i32 @_ZN5test16getvarEi( + // CHECK: define internal i32 @_ZN5test1L6getvarEi( static inline int getvar(int index) { static const int var[] = { 1, 0, 2, 4 }; return var[index];