llvm-project/llvm/unittests
Chandler Carruth dea00d7c5a 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
2012-06-16 08:52:57 +00:00
..
ADT Work around a bug with MSVC 10 where it fails to recognize a valid use 2012-06-16 03:54:11 +00:00
Analysis The product of two chrec's can always be represented as a chrec. 2011-10-04 06:51:26 +00:00
Bitcode Bitcode: Don't expose WriteBitcodeToStream to clients. 2012-02-29 20:30:56 +00:00
ExecutionEngine Disable JITTest.FunctionIsRecompiledAndRelinked and JITTest.NoStubs 2012-05-16 19:07:55 +00:00
Support Add support to the alignment support header for conjuring a character 2012-06-16 08:52:57 +00:00
Transforms Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
VMCore Fix typos found by http://github.com/lyda/misspell-check 2012-06-02 10:20:22 +00:00
CMakeLists.txt Add support to the alignment support header for conjuring a character 2012-06-16 08:52:57 +00:00
Makefile Undo the hack in r147427 and move this unittest to a better home. This 2012-01-02 09:19:48 +00:00
Makefile.unittest build/unittests: Fix llvm-config names for gtest libraries, and bring Makefile 2011-12-15 23:35:08 +00:00