From b7130ed888483494474650f5f6b8e9f547baa5c8 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Mon, 27 Jul 2009 05:54:15 +0000 Subject: [PATCH] Enable the new constant struct builder by default. The old code is still in place but will be removed shortly. The new struct builder works on big endian systems. llvm-svn: 77185 --- clang/lib/CodeGen/CGExprConstant.cpp | 7 ++++--- clang/test/CodeGen/PR3613-static-decl.c | 2 +- clang/test/CodeGen/const-init.c | 4 ++-- clang/test/CodeGen/designated-initializers.c | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b335e90..a64fb09 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -506,9 +506,10 @@ public: } llvm::Constant *EmitStructInitialization(InitListExpr *ILE) { - // FIXME: Use the returned struct when the builder works well enough. - ConstStructBuilder::BuildStruct(CGM, CGF, ILE); - + return ConstStructBuilder::BuildStruct(CGM, CGF, ILE); + + // FIXME: Remove the old struct builder once we're sure that the new one + // works well enough! const llvm::StructType *SType = cast(ConvertType(ILE->getType())); RecordDecl *RD = ILE->getType()->getAsRecordType()->getDecl(); diff --git a/clang/test/CodeGen/PR3613-static-decl.c b/clang/test/CodeGen/PR3613-static-decl.c index 365b9b2..44de0dc 100644 --- a/clang/test/CodeGen/PR3613-static-decl.c +++ b/clang/test/CodeGen/PR3613-static-decl.c @@ -1,5 +1,5 @@ // RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s && -// RUN: grep '@g0 = internal global .struct.s0 <{ i32 3 }>' %t | count 1 +// RUN: grep '@g0 = internal global %. { i32 3 }' %t | count 1 struct s0 { int a; diff --git a/clang/test/CodeGen/const-init.c b/clang/test/CodeGen/const-init.c index 0364cc1..2ee6f0d 100644 --- a/clang/test/CodeGen/const-init.c +++ b/clang/test/CodeGen/const-init.c @@ -59,7 +59,7 @@ long g11() { static char g12_tmp; long g12 = (long) &g12_tmp; -// RUN: grep '@g13 = global \[1 x .struct.g13_s0\] \[.struct.g13_s0 <{ i32 ptrtoint (i8\* @g12_tmp to i32) }>\]' %t && +// RUN: grep '@g13 = global %. <{ %. { i32 ptrtoint (i8\* @g12_tmp to i32) } }>' %t && struct g13_s0 { long a; }; @@ -85,7 +85,7 @@ void g18(void) { static int *p[] = { &g19 }; } -// RUN: grep '@g20.l0 = internal global .struct.g20_s1 <{ .struct.g20_s0\* null, .struct.g20_s0\*\* getelementptr (.struct.g20_s1\* @g20.l0, i32 0, i32 0) }>' %t && +// RUN: grep '@g20.l0 = internal global %. { .struct.g20_s0\* null, .struct.g20_s0\*\* getelementptr (.struct.g20_s1\* bitcast (%.\* @g20.l0 to .struct.g20_s1\*), i32 0, i32 0) }' %t && struct g20_s0; struct g20_s1 { diff --git a/clang/test/CodeGen/designated-initializers.c b/clang/test/CodeGen/designated-initializers.c index 4669339..f20bc78 100644 --- a/clang/test/CodeGen/designated-initializers.c +++ b/clang/test/CodeGen/designated-initializers.c @@ -1,5 +1,6 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "<{ i8\* null, i32 1024 }>" && -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 0, i32 22" +// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t && +// RUN: grep "{ i8\* null, i32 1024 }" %t && +// RUN: grep "i32 0, i32 22" %t struct foo { void *a; -- 2.7.4