[cfe-commits] r138775 - in /cfe/trunk: lib/Basic/Targets.cpp test/Driver/le32-unknown-nacl.cpp
Ivan Krasin
krasin at chromium.org
Mon Aug 29 15:39:12 PDT 2011
Author: krasin
Date: Mon Aug 29 17:39:12 2011
New Revision: 138775
URL: http://llvm.org/viewvc/llvm-project?rev=138775&view=rev
Log:
Clang/PNaCl: Improve test coverage for PNaClTargetInfo (type aligns), fixes nits:
- wrong alignment for double (it was 4, but 8 is desired),
- added checks for _REENTRANT define,
- fixed the issue that defines were not tested (because the check for inside #ifdef).
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/le32-unknown-nacl.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=138775&r1=138774&r2=138775&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Aug 29 17:39:12 2011
@@ -2856,6 +2856,8 @@
this->UIntMaxType = TargetInfo::UnsignedLongLong;
this->Int64Type = TargetInfo::SignedLongLong;
this->SizeType = TargetInfo::UnsignedInt;
+ this->DoubleAlign = 64;
+ this->LongDoubleAlign = 64;
DescriptionString = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"
"f32:32:32-f64:64:64-p:32:32:32-v128:32:32";
}
Modified: cfe/trunk/test/Driver/le32-unknown-nacl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/le32-unknown-nacl.cpp?rev=138775&r1=138774&r2=138775&view=diff
==============================================================================
--- cfe/trunk/test/Driver/le32-unknown-nacl.cpp (original)
+++ cfe/trunk/test/Driver/le32-unknown-nacl.cpp Mon Aug 29 17:39:12 2011
@@ -1,49 +1,82 @@
// RUN: %clang -ccc-host-triple le32-unknown-nacl -ccc-echo %s -emit-llvm -c 2>&1 | FileCheck %s -check-prefix=ECHO
// RUN: %clang -ccc-host-triple le32-unknown-nacl %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -ccc-host-triple le32-unknown-nacl %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
// ECHO: clang{{.*}} -cc1 {{.*}}le32-unknown-nacl.c
// Check platform defines
+#include <stdarg.h>
#include <stddef.h>
extern "C" {
+// CHECK: @align_c = global i32 1
+int align_c = __alignof(char);
+
+// CHECK: @align_s = global i32 2
+int align_s = __alignof(short);
+
+// CHECK: @align_i = global i32 4
+int align_i = __alignof(int);
+
+// CHECK: @align_l = global i32 4
+int align_l = __alignof(long);
+
+// CHECK: @align_ll = global i32 8
+int align_ll = __alignof(long long);
+
+// CHECK: @align_p = global i32 4
+int align_p = __alignof(void*);
+
+// CHECK: @align_f = global i32 4
+int align_f = __alignof(float);
+
+// CHECK: @align_d = global i32 8
+int align_d = __alignof(double);
+
+// CHECK: @align_ld = global i32 8
+int align_ld = __alignof(long double);
+
+// CHECK: @align_vl = global i32 4
+int align_vl = __alignof(va_list);
+
+// CHECK: __native_client__defined
#ifdef __native_client__
-void __native_client__defined() {
- // CHECK: __native_client__defined
-}
+void __native_client__defined() {}
#endif
+// CHECK: __le32__defined
#ifdef __le32__
-void __le32__defined() {
- // CHECK: __le32__defined
-}
+void __le32__defined() {}
#endif
+// CHECK: __pnacl__defined
#ifdef __pnacl__
-void __pnacl__defined() {
- // CHECK: __pnacl__defined
-}
+void __pnacl__defined() {}
#endif
+// CHECK: unixdefined
#ifdef unix
-void unixdefined() {
- // CHECK: unixdefined
-}
+void unixdefined() {}
#endif
+// CHECK: __ELF__defined
#ifdef __ELF__
-void __ELF__defined() {
- // CHECK: __ELF__defined
-}
+void __ELF__defined() {}
#endif
+// CHECK: _GNU_SOURCEdefined
#ifdef _GNU_SOURCE
-void _GNU_SOURCEdefined() {
- // CHECK: _GNU_SOURCEdefined
-}
+void _GNU_SOURCEdefined() {}
#endif
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
// Check types
@@ -91,8 +124,6 @@
}
-#include <stdarg.h>
-
template<int> void Switch();
template<> void Switch<4>();
template<> void Switch<8>();
More information about the cfe-commits
mailing list