зеркало из https://github.com/microsoft/clang.git
fix an unintended behavior change in the type system rewrite, which caused us to compile
stuff like this: typedef struct { int x, y, z; } foo_t; foo_t g; into: %"struct.<anonymous>" = type { i32, i32, i32 } we now get: %struct.foo_t = type { i32, i32, i32 } This doesn't change the behavior of the compiler, but makes the IR much easier to read. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
1961791626
Коммит
cd87d1e4d1
|
@ -451,10 +451,10 @@ llvm::StructType *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) {
|
|||
llvm::StructType *&Entry = RecordDeclTypes[Key];
|
||||
|
||||
// If we don't have a StructType at all yet, create the forward declaration.
|
||||
if (Entry == 0)
|
||||
Entry = llvm::StructType::createNamed(getLLVMContext(),
|
||||
std::string(RD->getKindName()) + "." +
|
||||
RD->getQualifiedNameAsString());
|
||||
if (Entry == 0) {
|
||||
Entry = llvm::StructType::createNamed(getLLVMContext(), "");
|
||||
addRecordTypeName(RD, Entry, "");
|
||||
}
|
||||
llvm::StructType *Ty = Entry;
|
||||
|
||||
// If this is still a forward declaration, or the LLVM type is already
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: @g1 = global [2 x i8*] [i8* getelementptr (i8* getelementptr inbounds ([0 x %"struct.<anonymous>"]* @g0, i32 0, i32 0, i32 0), i64 -2), i8* getelementptr (i8* getelementptr inbounds ([0 x %"struct.<anonymous>"]* @g0, i32 0, i32 0, i32 0), i64 -46)], align 16
|
||||
// CHECK: @g2 = global [2 x i8*] [i8* getelementptr (i8* getelementptr inbounds ([0 x %"struct.<anonymous>"]* @g0, i32 0, i32 0, i32 0), i64 -2), i8* getelementptr (i8* getelementptr inbounds ([0 x %"struct.<anonymous>"]* @g0, i32 0, i32 0, i32 0), i64 -46)], align 16
|
||||
// CHECK: @g1 = global [2 x i8*] [i8* getelementptr (i8* getelementptr inbounds ([0 x %struct.anon]* @g0, i32 0, i32 0, i32 0), i64 -2), i8* getelementptr (i8* getelementptr inbounds ([0 x %struct.anon]* @g0, i32 0, i32 0, i32 0), i64 -46)], align 16
|
||||
// CHECK: @g2 = global [2 x i8*] [i8* getelementptr (i8* getelementptr inbounds ([0 x %struct.anon]* @g0, i32 0, i32 0, i32 0), i64 -2), i8* getelementptr (i8* getelementptr inbounds ([0 x %struct.anon]* @g0, i32 0, i32 0, i32 0), i64 -46)], align 16
|
||||
|
||||
extern struct { unsigned char a, b; } g0[];
|
||||
void *g1[] = {g0 + -1, g0 + -23 };
|
||||
|
|
|
@ -52,14 +52,14 @@ int g9 = (2 + 3i) * (5 + 7i) != (-11 + 29i);
|
|||
int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
|
||||
|
||||
// PR5108
|
||||
// CHECK: @gv1 = global %"struct.<anonymous>" <{ i32 0, i8 7 }>, align 1
|
||||
// CHECK: @gv1 = global %struct.anon <{ i32 0, i8 7 }>, align 1
|
||||
struct {
|
||||
unsigned long a;
|
||||
unsigned long b:3;
|
||||
} __attribute__((__packed__)) gv1 = { .a = 0x0, .b = 7, };
|
||||
|
||||
// PR5118
|
||||
// CHECK: @gv2 = global %"struct.<anonymous>.0" <{ i8 1, i8* null }>, align 1
|
||||
// CHECK: @gv2 = global %struct.anon.0 <{ i8 1, i8* null }>, align 1
|
||||
struct {
|
||||
unsigned char a;
|
||||
char *b;
|
||||
|
|
|
@ -5,13 +5,13 @@ struct foo {
|
|||
int b;
|
||||
};
|
||||
|
||||
// CHECK: @u = global %"union.<anonymous>" zeroinitializer
|
||||
// CHECK: @u = global %union.anon zeroinitializer
|
||||
union { int i; float f; } u = { };
|
||||
|
||||
// CHECK: @u2 = global { i32, [4 x i8] } { i32 0, [4 x i8] undef }
|
||||
union { int i; double f; } u2 = { };
|
||||
|
||||
// CHECK: @u3 = global %"union.<anonymous>.1" zeroinitializer
|
||||
// CHECK: @u3 = global %union.anon.1 zeroinitializer
|
||||
union { double f; int i; } u3 = { };
|
||||
|
||||
// CHECK: @b = global [2 x i32] [i32 0, i32 22]
|
||||
|
@ -39,11 +39,11 @@ struct ds ds0 = { { { .a = 0 } } };
|
|||
struct ds ds1 = { { .a = 1 } };
|
||||
struct ds ds2 = { { .b = 1 } };
|
||||
struct ds ds3 = { .a = 0 };
|
||||
// CHECK: @ds4 = global %struct.ds { %"struct.ds::<anonymous>" { %"struct.ds::<anonymous struct>::<anonymous>" zeroinitializer, i16 0, %"struct.ds::<anonymous struct>::<anonymous>.2" { i16 1 } } }
|
||||
// CHECK: @ds4 = global %struct.ds { %struct.anon.3 { %struct.anon zeroinitializer, i16 0, %struct.anon.2 { i16 1 } } }
|
||||
struct ds ds4 = { .c = 1 };
|
||||
struct ds ds5 = { { { .a = 0 } }, .b = 1 };
|
||||
struct ds ds6 = { { .a = 0, .b = 1 } };
|
||||
// CHECK: @ds7 = global %struct.ds { %"struct.ds::<anonymous>" { %"struct.ds::<anonymous struct>::<anonymous>" { i16 2 }, i16 3, %"struct.ds::<anonymous struct>::<anonymous>.2" zeroinitializer } }
|
||||
// CHECK: @ds7 = global %struct.ds { %struct.anon.3 { %struct.anon { i16 2 }, i16 3, %struct.anon.2 zeroinitializer } }
|
||||
struct ds ds7 = {
|
||||
{ {
|
||||
.a = 1
|
||||
|
@ -59,7 +59,7 @@ void test1(int argc, char **argv)
|
|||
.b = 1024,
|
||||
};
|
||||
|
||||
// CHECK: bitcast %union.* %u2
|
||||
// CHECK: bitcast %union.anon.4* %u2
|
||||
// CHECK: call void @llvm.memset
|
||||
union { int i; float f; } u2 = { };
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ void f1(int i, int j, int k) { }
|
|||
|
||||
int
|
||||
main(void) {
|
||||
// CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %"struct.<anonymous>"* inreg null
|
||||
// CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.foo* inreg null
|
||||
reduced(0, 0.0, 0, 0.0, 0);
|
||||
// CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2)
|
||||
bar(1,2);
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef union {
|
|||
void f0(transp_t0 obj);
|
||||
|
||||
// CHECK: define void @f1_0(i32* %a0)
|
||||
// CHECK: call void @f0(%"union.<anonymous>"* byval align 4 %{{.*}})
|
||||
// CHECK: call void @f0(%union.transp_t0* byval align 4 %{{.*}})
|
||||
// CHECK: call void %{{.*}}(i8* %{{[a-z0-9]*}})
|
||||
// CHECK: }
|
||||
void f1_0(int *a0) {
|
||||
|
|
|
@ -58,7 +58,7 @@ struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} }
|
|||
struct s10 { int a; int b; int : 0; };
|
||||
void f10(struct s10 a0) {}
|
||||
|
||||
// CHECK: define void @f11(%"union.<anonymous>"* sret %agg.result)
|
||||
// CHECK: define void @f11(%union.anon* sret %agg.result)
|
||||
union { long double a; float b; } f11() { while (1) {} }
|
||||
|
||||
// CHECK: define i32 @f12_0()
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ZeroInit {
|
|||
// CHECK-GLOBAL: @_ZN8ZeroInit1bE = global i64 -1,
|
||||
int A::* b = 0;
|
||||
|
||||
// CHECK-GLOBAL: @_ZN8ZeroInit2saE = internal global %"struct.ZeroInit::<anonymous>" { i64 -1 }
|
||||
// CHECK-GLOBAL: @_ZN8ZeroInit2saE = internal global %struct.anon { i64 -1 }
|
||||
struct {
|
||||
int A::*a;
|
||||
} sa;
|
||||
|
@ -35,7 +35,7 @@ namespace ZeroInit {
|
|||
} ssa[2];
|
||||
void test_ssa() { (void) ssa; }
|
||||
|
||||
// CHECK-GLOBAL: @_ZN8ZeroInit2ssE = internal global %"struct.ZeroInit::<anonymous>.1" { %"struct.ZeroInit::<anonymous struct>::<anonymous>" { i64 -1 } }
|
||||
// CHECK-GLOBAL: @_ZN8ZeroInit2ssE = internal global %struct.anon.1 { %struct.anon.2 { i64 -1 } }
|
||||
struct {
|
||||
struct {
|
||||
int A::*pa;
|
||||
|
|
Загрузка…
Ссылка в новой задаче