summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/CMakeLists.txt
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-06-16 08:52:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-06-16 08:52:57 +0000
commitdea00d7c5a35c1f930e8b3cd910461048ab5244c (patch)
tree4dd3697a7151bc68f100cf85f6c2e3c63ebff8c5 /llvm/unittests/CMakeLists.txt
parent8bd8ee76486f6bf46e123d6c9e09d5c2ccc86442 (diff)
downloadbcm5719-llvm-dea00d7c5a35c1f930e8b3cd910461048ab5244c.tar.gz
bcm5719-llvm-dea00d7c5a35c1f930e8b3cd910461048ab5244c.zip
Add support to the alignment support header for conjuring a character
array of a suitable size and alignment for any of a number of different types to be stored into the character array. The mechanisms for producing an explicitly aligned type are fairly complex because this operation is poorly supported on all compilers. We've spent a fairly significant amount of time experimenting with different implementations inside of Google, and the one using explicitly expanded templates has been the most robust. Credit goes to Nick Lewycky for writing the first 20 versions or so of this logic we had inside of Google. I based this on the only one to actually survive. In case anyone is worried, yes we are both explicitly re-contributing and re-licensing it for LLVM. =] Once the issues with actually specifying the alignment are finished, it turns out that most compilers don't in turn align anything the way they are instructed. Testing of this logic against both Clang and GCC indicate that the alignment constraints are largely ignored by both compilers! I've come up with and used a work-around by wrapping each alignment-hinted type directly in a struct, and using that struct to align the character array through a union. This elaborate hackery is terrifying, but I've included testing that caught a terrifying number of bugs in every other technique I've tried. All of this in order to implement a poor C++98 programmers emulation of C++11 unrestricted unions in classes such as SmallDenseMap. llvm-svn: 158597
Diffstat (limited to 'llvm/unittests/CMakeLists.txt')
-rw-r--r--llvm/unittests/CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt
index 11a5a5ac975..bfb05edade2 100644
--- a/llvm/unittests/CMakeLists.txt
+++ b/llvm/unittests/CMakeLists.txt
@@ -166,6 +166,7 @@ set(LLVM_LINK_COMPONENTS
)
add_llvm_unittest(Support
+ Support/AlignOfTest.cpp
Support/AllocatorTest.cpp
Support/Casting.cpp
Support/CommandLineTest.cpp
OpenPOWER on IntegriCloud