Sw<int> swi;
Sw<B> swb;
}
-// CHECK-NOT: define linkonce_odr {{.*}} @_ZN2SwI1BED1Ev({{.*}} #2
+// CHECK-NOT: define linkonce_odr {{.*}} @_ZN2SwI1BED1Ev({{.*}} #
// CHECK: define linkonce_odr {{.*}} @_ZN2SwI1BED1Ev({{.*}}
// CHECK: _ZTIi
// CHECK: __cxa_call_unexpected
-// CHECK: define linkonce_odr {{.*}} @_ZN2SwIiED1Ev({{.*}} #2
+// CHECK: define linkonce_odr {{.*}} @_ZN2SwIiED1Ev({{.*}} [[ATTRGRP:#[0-9]+]]
template <typename T>
struct TVC : VX
template <typename T>
TVC<T>::~TVC() {}
-// CHECK: attributes #0 = { "target-features"={{.*}} }
-// CHECK: attributes #1 = { noinline noreturn nounwind }
-// CHECK: attributes #2 = { nounwind "target-features"={{.*}} }
-// CHECK: attributes #3 = { inlinehint nounwind "target-features"={{.*}} }
+// CHECK: attributes [[ATTRGRP]] = { nounwind "target-features"={{.*}} }
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix ASAN %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix=ASAN %s
// RUN: echo "src:%s" > %t
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address -fsanitize-blacklist=%t | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address -fsanitize-blacklist=%t | FileCheck -check-prefix=BL %s
// FIXME: %t is like "src:x:\path\to\clang\test\CodeGen\address-safety-attr.cpp"
// REQUIRES: shell
// when AddressSanitizer is enabled, unless no_address_safety_analysis attribute
// is present.
-// CHECK: NoAddressSafety1{{.*}}#0
-// ASAN: NoAddressSafety1{{.*}}#0
+// WITHOUT: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
+// BL: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
+// ASAN: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
__attribute__((no_address_safety_analysis))
int NoAddressSafety1(int *a) { return *a; }
-// CHECK: NoAddressSafety2{{.*}}#0
-// ASAN: NoAddressSafety2{{.*}}#0
+// WITHOUT: NoAddressSafety2{{.*}}) #[[NOATTR]]
+// BL: NoAddressSafety2{{.*}}) #[[NOATTR]]
+// ASAN: NoAddressSafety2{{.*}}) #[[NOATTR]]
__attribute__((no_address_safety_analysis))
int NoAddressSafety2(int *a);
int NoAddressSafety2(int *a) { return *a; }
-// CHECK: AddressSafetyOk{{.*}}#0
-// ASAN: AddressSafetyOk{{.*}}#1
+// WITHOUT: AddressSafetyOk{{.*}}) #[[NOATTR]]
+// BL: AddressSafetyOk{{.*}}) #[[NOATTR]]
+// ASAN: AddressSafetyOk{{.*}}) #[[WITH:[0-9]+]]
int AddressSafetyOk(int *a) { return *a; }
-// CHECK: TemplateAddressSafetyOk{{.*}}#0
-// ASAN: TemplateAddressSafetyOk{{.*}}#1
+// WITHOUT: TemplateAddressSafetyOk{{.*}}) #[[NOATTR]]
+// BL: TemplateAddressSafetyOk{{.*}}) #[[NOATTR]]
+// ASAN: TemplateAddressSafetyOk{{.*}}) #[[WITH]]
template<int i>
int TemplateAddressSafetyOk() { return i; }
-// CHECK: TemplateNoAddressSafety{{.*}}#0
-// ASAN: TemplateNoAddressSafety{{.*}}#0
+// WITHOUT: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
+// BL: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
+// ASAN: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
template<int i>
__attribute__((no_address_safety_analysis))
int TemplateNoAddressSafety() { return i; }
// Check that __cxx_global_var_init* get the address_safety attribute.
int global1 = 0;
int global2 = *(int*)((char*)&global1+1);
-// CHECK: @__cxx_global_var_init{{.*}}#1
+// WITHOUT: @__cxx_global_var_init{{.*}}#1
+// BL: @__cxx_global_var_init{{.*}}#1
// ASAN: @__cxx_global_var_init{{.*}}#2
-// CHECK: attributes #0 = { nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { nounwind }
+// WITHOUT: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
+// BL: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
-// ASAN: attributes #0 = { nounwind "target-features"={{.*}} }
-// ASAN: attributes #1 = { address_safety nounwind "target-features"={{.*}} }
-// ASAN: attributes #2 = { address_safety nounwind }
+// ASAN: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
+// ASAN: attributes #[[WITH]] = { address_safety nounwind "target-features"={{.*}} }
return 42;
// Check that we set the optsize attribute on the function.
-// CHECK: @test1{{.*}}#0
+// CHECK: @test1{{.*}}[[ATTR:#[0-9]+]]
// CHECK: ret
}
-// CHECK: attributes #0 = { nounwind optsize "target-features"={{.*}} }
+// CHECK: attributes [[ATTR]] = { {{.*}}optsize{{.*}} }
// Check that we set the minsize attribute on each function
// when Oz optimization level is set.
+__attribute__((minsize))
int test1() {
return 42;
-// Oz: @{{.*}}test1{{.*}}#0
-// Oz: ret
-// OTHER: @{{.*}}test1
-// OTHER-NOT: #1
-// OTHER: ret
+// Oz: @{{.*}}test1{{.*}}[[MINSIZE:#[0-9]+]]
+// OTHER: @{{.*}}test1{{.*}}[[MS:#[0-9]+]]
}
int test2() {
return 42;
-// Oz: @{{.*}}test2{{.*}}#0
+// Oz: @{{.*}}test2{{.*}}[[MINSIZE]]
// Oz: ret
// OTHER: @{{.*}}test2
-// OTHER-NOT: #1
+// OTHER-NOT: [[MS]]
// OTHER: ret
}
-__attribute__((minsize))
int test3() {
return 42;
-// Oz: @{{.*}}test3{{.*}}#0
-// OTHER: @{{.*}}test3{{.*}}#1
+// Oz: @{{.*}}test3{{.*}}[[MINSIZE]]
+// Oz: ret
+// OTHER: @{{.*}}test3
+// OTHER-NOT: [[MS]]
+// OTHER: ret
}
// Check that the minsize attribute is well propagated through
template
void test4<int>(int arg);
// Oz: define{{.*}}void @{{.*}}test4
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test4
-// OTHER: #1
+// OTHER: [[MS]]
template
void test4<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test4
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test4
-// OTHER: #1
+// OTHER: [[MS]]
template<typename T>
void test5(T arg) {
template
void test5<int>(int arg);
// Oz: define{{.*}}void @{{.*}}test5
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test5
-// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}#1
+// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
template
void test5<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test5
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test5
-// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}#1
+// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
-// Oz: attributes #0 = { minsize nounwind optsize readnone "target-features"={{.*}} }
+// Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
-// OTHER: attributes #0 = { nounwind {{.*}}"target-features"={{.*}} }
-// OTHER: attributes #1 = { minsize nounwind {{.*}}"target-features"={{.*}} }
+// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
// Check that the noredzone flag is set on the generated functions.
-// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr #1
-// CHECK: void @__llvm_gcov_writeout() unnamed_addr #1
-// CHECK: void @__llvm_gcov_init() unnamed_addr #1
-// CHECK: void @__gcov_flush() unnamed_addr #1
+// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr [[NRZ:#[0-9]+]]
+// CHECK: void @__llvm_gcov_writeout() unnamed_addr [[NRZ]]
+// CHECK: void @__llvm_gcov_init() unnamed_addr [[NRZ]]
+// CHECK: void @__gcov_flush() unnamed_addr [[NRZ]]
-// CHECK: attributes #0 = { noredzone nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { noinline noredzone }
+// CHECK: attributes [[NRZ]] = { {{.*}}noredzone{{.*}} }
printf("%s\n", a);
}
-// NOSSP: attributes #0 = { nounwind "target-features"={{.*}} }
-// NOSSP: attributes #1 = { "target-features"={{.*}} }
-// NOSSP: attributes #2 = { nounwind }
+// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
-// WITHSSP: attributes #0 = { nounwind ssp "target-features"={{.*}} }
-// WITHSSP: attributes #1 = { "target-features"={{.*}} }
-// WITHSSP: attributes #2 = { nounwind }
+// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
-// SSPREQ: attributes #0 = { nounwind sspreq "target-features"={{.*}} }
-// SSPREQ: attributes #1 = { "target-features"={{.*}} }
-// SSPREQ: attributes #2 = { nounwind }
+// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
int g();
-// CHECK: _Z1fv(){{.*}} #0
+// CHECK: _Z1fv(){{.*}} [[NR:#[0-9]+]]
[[noreturn]] int f() {
while (g()) {}
}
-// CHECK: attributes #0 = { noreturn nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { "target-features"={{.*}} }
-// CHECK: attributes #2 = { noreturn nounwind }
+// CHECK: attributes [[NR]] = { noreturn nounwind{{.*}} }
// This was a problem in Sema, but only shows up as noinline missing
// in CodeGen.
-// CHECK: define linkonce_odr void @_ZN6VectorIiE13growStorageByEv(%struct.Vector* %this) #1
+// CHECK: define linkonce_odr void @_ZN6VectorIiE13growStorageByEv(%struct.Vector* %this) [[NI:#[0-9]+]]
template <class Ty> struct Vector {
void growStorageBy();
strs.growStorageBy();
}
-// CHECK: attributes #0 = { nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { noinline nounwind "target-features"={{.*}} }
+// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix ASAN %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix=ASAN %s
@interface MyClass
+ (int) addressSafety:(int*)a;
@implementation MyClass
-// CHECK: +[MyClass load]{{.*}}#0
+// WITHOUT: +[MyClass load]{{.*}}#0
// ASAN: +[MyClass load]{{.*}}#0
+(void) load { }
-// CHECK: +[MyClass addressSafety:]{{.*}}#0
+// WITHOUT: +[MyClass addressSafety:]{{.*}}#0
// ASAN: +[MyClass addressSafety:]{{.*}}#0
+ (int) addressSafety:(int*)a { return *a; }
@end
-// CHECK: attributes #0 = { nounwind "target-features"={{.*}} }
-// ASAN: attributes #0 = { address_safety nounwind "target-features"={{.*}} }
+// WITHOUT: attributes #0 = { nounwind{{.*}} }
+// ASAN: attributes #0 = { address_safety nounwind{{.*}} }