summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/AlignOfTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Remove LLVM_ALIGNASJF Bastien2019-07-311-4/+4
| | | | | | | | | | | | | | Summary: The minimum compilers support all have alignas, and we don't use LLVM_ALIGNAS anywhere anymore. This also removes an MSVC diagnostic which, according to the comment above, isn't relevant anymore. Reviewers: rnk Subscribers: mgorny, jkorous, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65458 llvm-svn: 367383
* [NFC] use C++11 in AlignOf.h, remove AlignedCharArrayJF Bastien2019-07-301-11/+0
| | | | | | | | | I removed all uses of AlignedCharArray since the minimum MSVC version can handle alignas on char arrays correctly. We can therefore remove AlignedCharArray. This patch also updates AlignedCharArrayUnion to use C++11. llvm-svn: 367282
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Revert r291503, "Lift the 10-type limit for AlignedCharArrayUnion", and ↵NAKAMURA Takumi2017-01-131-18/+0
| | | | | | | | | | | | | followings. r291503, "Lift the 10-type limit for AlignedCharArrayUnion" r291514, "Fix MSVC build of AlignedCharArrayUnion" r291515, "Revert the attempt to optimize the constexpr functions. MSVC does not handle this yet" r291519, "Try once again to fix the MSVC build of AlignedCharArrayUnion" They has been failing on i686-linux. llvm-svn: 291875
* Lift the 10-type limit for AlignedCharArrayUnionSean Callanan2017-01-091-0/+18
| | | | | | | | | | This patch uses C++11 parameter packs and constexpr functions to allow AlignedCharArrayUnion to hold an arbitrary number of types. Differential Revision: https://reviews.llvm.org/D28429 llvm-svn: 291503
* [Support] Fix AlignOf test on i386-linux.Benjamin Kramer2016-10-211-12/+15
| | | | | | | | | On i386 alignof(double) = 8 is not the same as alignof(struct { double }) = 4. This used to be not an issue because the old implementation always measured alignment inside of structs. Wrap a dummy struct around the test to avoid this issue. llvm-svn: 284812
* [Support] Remove llvm::alignOf now that all uses are gone.Benjamin Kramer2016-10-201-166/+55
| | | | | | | | | Also clean up the legacy hacks for AlignedCharArray. I'm keeping LLVM_ALIGNAS alive for a bit longer because GCC 4.8.0 (which we still support apparently) shipped a buggy alignas(). All other supported compilers have a working alignas. llvm-svn: 284736
* Fixed compilation issue.Elena Demikhovsky2016-01-281-1/+1
| | | | llvm-svn: 259087
* Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; ↵Eugene Zelenko2016-01-261-4/+4
| | | | | | | | other minor fixes. Differential revision: reviews.llvm.org/D16568 llvm-svn: 258831
* [ADT] Teach alignment helpers to work correctly for abstract classes.Chandler Carruth2015-12-291-0/+20
| | | | | | | | | | | | This is necessary to use them as part of pointer traits and is generally useful. I've added unit test coverage to isolate and ensure this works correctly. I'll watch the build bots to try to see if any compilers can't tolerate this bit of magic (and much credit goes to Richard Smith for coming up with this magical production!) but give a shout if you see issues. llvm-svn: 256553
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-5/+15
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* [support] Add a macro wrapper for alignas and simplify some code.Benjamin Kramer2015-04-021-18/+4
| | | | | | | | We wrap __attribute((aligned)) for GCC 4.7 and __declspec(align) for MSVC. The latter behaves weird in some contexts so this should be used carefully. llvm-svn: 233910
* Supress MSVC padding warning in alignment testAndrew Kaylor2015-03-261-0/+6
| | | | llvm-svn: 233305
* Suppress the newly added Clang warning for the inaccessible base in thisChandler Carruth2015-01-191-4/+4
| | | | | | | | test. Do that after we suppress the warnings for unknown pragmas as this warning flag is quite new in Clang and so old Clang's would warn all the time on this file. llvm-svn: 226444
* [AlignOf] Add AlignedCharArray and refactor AlignedCharArrayUnion.Michael J. Spencer2012-12-311-2/+11
| | | | | | | This adds AlignedCharArray<Alignment, Size>. A templated struct that contains a member named buffer of type char[Size] that is aligned to Alignment. llvm-svn: 171319
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+0
| | | | llvm-svn: 169250
* Removing utf-8 smart quote and trailing whitespaceJoe Abbey2012-11-171-2/+2
| | | | llvm-svn: 168253
* Suppressing the 'direct base ‘{anonymous}::S1’ inaccessible in ↵Joe Abbey2012-11-171-0/+12
| | | | | | | | ‘{anonymous}::D9’ due to ambiguity' warning. llvm-svn: 168251
* Provide definitions for all functions.Benjamin Kramer2012-11-101-0/+11
| | | | | | | ICC refuses to compile a class in an anonymous namespace if some functions aren't defined. Fixes PR13477. llvm-svn: 167676
* Fix up erroneous alignas usage while making this portable to GCC 4.7David Blaikie2012-09-141-71/+47
| | | | | | Review by Chandler Carruth. llvm-svn: 163944
* Flatten the aligned-char-array utility template to be a directlyChandler Carruth2012-08-171-117/+117
| | | | | | | templated union at the request of Richard Smith. This makes it substantially easier to type. =] llvm-svn: 162072
* Add a pragma to supress an MSVC warning on some of the absurd code I'mChandler Carruth2012-06-211-0/+6
| | | | | | | | using to test the alignment support library. Patch from Nikola on IRC. llvm-svn: 158912
* Disable a particular assertion on MSVC... I'm deeply disturbed by itsChandler Carruth2012-06-171-0/+5
| | | | | | implementation of the class layout for the V8 type. llvm-svn: 158640
* Add some somewhat exhaustive tests of sizeof properties of this horribleChandler Carruth2012-06-171-0/+60
| | | | | | construct just for my sanity. llvm-svn: 158637
* Relax one assertion -- long double has strange alignments on lots ofChandler Carruth2012-06-161-1/+6
| | | | | | | | | platforms. Also, remove one assertion on MSVC because it produces a completely preposterous result, claiming something needs 12-byte alignment. llvm-svn: 158599
* Try to reduce the size of the array used for compile-time testing byChandler Carruth2012-06-161-44/+48
| | | | | | making the bounds all '1', and chunking it a bit. llvm-svn: 158598
* Add support to the alignment support header for conjuring a characterChandler Carruth2012-06-161-0/+248
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
OpenPOWER on IntegriCloud