X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FSupport%2FAlignOfTest.cpp;h=40f729585728cc193fff4f3f98151eb13f2a2387;hb=7172b38af7ed5d1c1e2c97fadfb0ae0c19aff816;hp=15935446fb14b26b817775e1db5191645f73e8df;hpb=e68d7437535b85a840b0958a4ff2d98210e399f4;p=oota-llvm.git diff --git a/unittests/Support/AlignOfTest.cpp b/unittests/Support/AlignOfTest.cpp index 15935446fb1..40f72958572 100644 --- a/unittests/Support/AlignOfTest.cpp +++ b/unittests/Support/AlignOfTest.cpp @@ -9,23 +9,21 @@ #include "llvm/Support/AlignOf.h" #include "llvm/Support/Compiler.h" - #include "gtest/gtest.h" using namespace llvm; namespace { - // Disable warnings about questionable type definitions. // We're testing that even questionable types work with the alignment utilities. #ifdef _MSC_VER #pragma warning(disable:4584) #endif -// Suppress direct base ‘{anonymous}::S1’ inaccessible in ‘{anonymous}::D9’ +// Suppress direct base '{anonymous}::S1' inaccessible in '{anonymous}::D9' // due to ambiguity warning. // -// Pragma based warning suppression was introduced in GGC 4.2. Additionally +// Pragma based warning suppression was introduced in GGC 4.2. Additionally // this warning is "enabled by default". The warning still appears if -Wall is // suppressed. Apparently GCC suppresses it when -w is specifed, which is odd. // At any rate, clang on the other hand gripes about -Wunknown-pragma, so @@ -322,6 +320,16 @@ TEST(AlignOfTest, BasicAlignedArray) { #ifndef _MSC_VER EXPECT_EQ(sizeof(V8), sizeof(AlignedCharArrayUnion)); #endif -} + EXPECT_EQ(1u, (alignOf >())); + EXPECT_EQ(2u, (alignOf >())); + EXPECT_EQ(4u, (alignOf >())); + EXPECT_EQ(8u, (alignOf >())); + EXPECT_EQ(16u, (alignOf >())); + + EXPECT_EQ(1u, sizeof(AlignedCharArray<1, 1>)); + EXPECT_EQ(7u, sizeof(AlignedCharArray<1, 7>)); + EXPECT_EQ(2u, sizeof(AlignedCharArray<2, 2>)); + EXPECT_EQ(16u, sizeof(AlignedCharArray<2, 16>)); +} }