llvm-project/clang/test/CodeGenCXX/debug-info-globalinit.cpp
Nikita Popov 532dc62b90 [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)
This adds -no-opaque-pointers to clang tests whose output will
change when opaque pointers are enabled by default. This is
intended to be part of the migration approach described in
https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9.

The patch has been produced by replacing %clang_cc1 with
%clang_cc1 -no-opaque-pointers for tests that fail with opaque
pointers enabled. Worth noting that this doesn't cover all tests,
there's a remaining ~40 tests not using %clang_cc1 that will need
a followup change.

Differential Revision: https://reviews.llvm.org/D123115
2022-04-07 12:09:47 +02:00

39 lines
1.2 KiB
C++

// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -std=c++11 -debug-info-kind=limited | FileCheck %s
void crash() {
volatile char *ptr = 0;
char x = *ptr;
}
int test() {
crash();
return 1;
}
static int i = test();
__attribute__((nodebug)) static int j = test();
static int k = test();
int main(void) {}
// CHECK-LABEL: define internal void @__cxx_global_var_init()
// CHECK-NOT: __cxx_global_var_init
// CHECK: %[[C0:.+]] = call noundef i32 @_Z4testv(), !dbg ![[LINE:.*]]
// CHECK-NOT: __cxx_global_var_init
// CHECK: store i32 %[[C0]], i32* @_ZL1i, align 4, !dbg
//
// CHECK-LABEL: define internal void @__cxx_global_var_init.1()
// CHECK-NOT: dbg
// CHECK: %[[C1:.+]] = call noundef i32 @_Z4testv()
// CHECK-NOT: dbg
// CHECK: store i32 %[[C1]], i32* @_ZL1j, align 4
//
// CHECK-LABEL: define internal void @__cxx_global_var_init.2()
// CHECK-NOT: __cxx_global_var_init
// CHECK: %[[C2:.+]] = call noundef i32 @_Z4testv(), !dbg ![[LINE2:.*]]
// CHECK-NOT: __cxx_global_var_init
// CHECK: store i32 %[[C2]], i32* @_ZL1k, align 4, !dbg
//
// CHECK: ![[LINE]] = !DILocation(line: 13,
// CHECK: ![[LINE2]] = !DILocation(line: 15,