-// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
// CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
// CHECK: @base_req = global [4 x i8] c"foo\00", align 1
// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0, comdat, align 4
// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0, comdat, align 8{{$}}
// CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
-// CHECK: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8
+// CHECK98: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8
+// CHECK11: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global { i8** } { i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN5test49HasVTableE, i32 0, inrange i32 0, i32 2) }, comdat, align 8
struct A {
A();
useStaticLocal();
}
// CHECK: define linkonce_odr dereferenceable(8) %"struct.test4::HasVTable"* @_ZN5test414useStaticLocalEv()
-// CHECK: ret %"struct.test4::HasVTable"* @_ZZN5test414useStaticLocalEvE3obj
+// CHECK: ret %"struct.test4::HasVTable"*{{.*}} @_ZZN5test414useStaticLocalEvE3obj
}
-// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++98 -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
// CHECK: @i = global [[INT:i[0-9]+]] 0
volatile int i, j, k;
asm("nop"); // CHECK: call void asm
- // should not load
+ // should not load in C++98
i;
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
(float)(ci);
// CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0)
// CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1)
// CHECK-NEXT: sitofp [[INT]]
- // These are not uses in C++:
+ // These are not uses in C++98:
// [expr.static.cast]p6:
// The lvalue-to-rvalue . . . conversions are not applied to the expression.
(void)ci;
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0)
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1)
+
(void)a;
(void)(ci=ci);
// CHECK-NEXT: load volatile
// CHECK-NEXT: sitofp
- (void)i;
+ (void)i; // This is now a load in C++11
+ // CHECK11-NEXT: load volatile
i=i;
// CHECK-NEXT: load volatile
// CHECK-NEXT: br label
// CHECK: phi
- (void)(i,(i=i));
+ (void)(i,(i=i)); // first i is also a load in C++11
+ // CHECK11-NEXT: load volatile
// CHECK-NEXT: load volatile
// CHECK-NEXT: store volatile
- i=i,k;
+ i=i,k; // k is also a load in C++11
// CHECK-NEXT: load volatile [[INT]], [[INT]]* @i
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k
(i=j,k=j);
// CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
// CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k
- (i=j,k);
+ (i=j,k); // k is also a load in C++11
// CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k
- (i,j);
+ (i,j); // i and j both are loads in C++11
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @j
// Extra load in C++.
i=c=k;
// CHECK-NEXT: add nsw [[INT]]
// CHECK-NEXT: store volatile
- ci;
+ ci; // ci is a load in C++11
+ // CHECK11-NEXT: load volatile {{.*}} @ci, i32 0, i32 0
+ // CHECK11-NEXT: load volatile {{.*}} @ci, i32 0, i32 1
asm("nop"); // CHECK-NEXT: call void asm
// CHECK-NEXT: load volatile
// CHECK-NEXT: add
- (i,j)=k;
+ (i,j)=k; // i is also a load in C++11
// CHECK-NEXT: load volatile [[INT]], [[INT]]* @k
+ // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
// CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j
(j=k,i)=i;