[llvm-commits] [llvm] r158637 - /llvm/trunk/unittests/Support/AlignOfTest.cpp
Gabor Greif
gabor at mac.com
Sun Jun 17 03:48:38 PDT 2012
Candler wrote:
> ...
> + EXPECT_EQ(sizeof(char), sizeof
> (AlignedCharArray<char>::union_type));
> + EXPECT_EQ(sizeof(char[1]), sizeof(AlignedCharArray<char[1]
> >::union_type));
> + EXPECT_EQ(sizeof(char[2]), sizeof(AlignedCharArray<char[2]
> >::union_type));
> + EXPECT_EQ(sizeof(char[3]), sizeof(AlignedCharArray<char[3]
> >::union_type));
> + EXPECT_EQ(sizeof(char[4]), sizeof(AlignedCharArray<char[4]
> >::union_type));
> + EXPECT_EQ(sizeof(char[5]), sizeof(AlignedCharArray<char[5]
> >::union_type));
> ...
And to save all other people's sanity ;-) you could introduce a macro
like this:
#define EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(A) \
EXPECT_EQ(sizeof(A), sizeof(AlignedCharArray<A>::union_type))
and then
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char)
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[1])
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[2])
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[3])
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[4])
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[5])
Cheers,
Gabor
More information about the llvm-commits
mailing list