summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/TrailingObjectsTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Alignment][NFC] Move and type functions from MathExtras to AlignmentGuillaume Chatelet2019-10-141-1/+1
| | | | | | | | | | | | | | | | | Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68942 llvm-svn: 374773
* 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
* Workaround MSVC bug when using TrailingObjects from a template.James Y Knight2017-02-281-0/+21
| | | | | | | | | | | | | MSVC appears to be getting confused as to whether OverloadToken is supposed to be public or not. This was discovered by code in Swift, and has been reported to microsoft by hughbe: https://connect.microsoft.com/VisualStudio/feedback/details/3116517 Differential Revision: https://reviews.llvm.org/D29880 llvm-svn: 296497
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-29/+24
| | | | | | No functionality change intended. llvm-svn: 284733
* TrailingObjects::FixedSizeStorage constexpr fixes + testsHubert Tong2016-07-301-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes issues with `LLVM_CONSTEXPR` functions and `TrailingObjects::FixedSizeStorage`. In particular, some of the functions marked `LLVM_CONSTEXPR` used by `FixedSizeStorage` were not implemented such that they evaluate successfully as part of a constant expression despite constant arguments. This change also implements a more traditional template-meta path to accommodate MSVC, and adds unit tests for `FixedSizeStorage`. Drive-by fix: the access control for members of `TrailingObjectsImpl` is tightened. Reviewers: faisalv, rsmith, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22668 llvm-svn: 277270
* Remove TrailingObjects::operator delete. It's still suffering fromRichard Smith2016-02-091-2/+2
| | | | | | | | | compiler-specific issues. Instead, repeat an 'operator delete' definition in each derived class that is actually deleted, and give up on the static type safety of an error when sized delete is accidentally used on a type derived from TrailingObjects. llvm-svn: 260190
* Re-commit r259942 (reverted in r260053) with a different workaround for the ↵Richard Smith2016-02-091-0/+2
| | | | | | | | | | | | | | | MSVC bug. This fixes undefined behavior in C++14 due to the size of the object being deleted being different from sizeof(dynamic type) when it is allocated with trailing objects. MSVC seems to have several bugs around using-declarations changing the access of a member inherited from a base class, so use forwarding functions instead of using-declarations to make TrailingObjects::operator delete accessible where desired. llvm-svn: 260180
* Revert 259942, r259943, r259948.Nico Weber2016-02-071-2/+0
| | | | | | | | | | | | | | | | The Windows bots have been failing for the last two days, with: FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -c LLVMContextImpl.cpp D:\buildslave\clang-x64-ninja-win7\llvm\lib\IR\LLVMContextImpl.cpp(137) : error C2248: 'llvm::TrailingObjects<llvm::AttributeSetImpl, llvm::IndexAttrPair>::operator delete' : cannot access private member declared in class 'llvm::AttributeSetImpl' TrailingObjects.h(298) : see declaration of 'llvm::TrailingObjects<llvm::AttributeSetImpl, llvm::IndexAttrPair>::operator delete' AttributeImpl.h(213) : see declaration of 'llvm::AttributeSetImpl' llvm-svn: 260053
* More workarounds for undefined behavior exposed when compiling in C++14 withRichard Smith2016-02-051-0/+2
| | | | | | | | -fsized-deallocation. Disable sized deallocation for all objects derived from TrailingObjects, as we expect the storage allocated for these objects to be larger than the size of their dynamic type. llvm-svn: 259942
* Update to use new name alignTo().Rui Ueyama2016-01-141-6/+5
| | | | llvm-svn: 257804
* [TrailingObjects] Dynamically realign under-aligned trailing objects.James Y Knight2015-12-291-0/+17
| | | | | | | | | | | | | | Previously, the code enforced non-decreasing alignment of each trailing type. However, it's easy enough to allow for realignment as needed, and thus avoid the developer having to think about the possiblilities for alignment requirements on all architectures. (E.g. on Linux/x86, a struct with an int64 member is 4-byte aligned, while on other 32-bit archs -- and even with other OSes on x86 -- it has 8-byte alignment. This sort of thing is irritating to have to manually deal with.) llvm-svn: 256533
* fix leak in a test, make the sanitizer bot greenKostya Serebryany2015-12-211-1/+2
| | | | llvm-svn: 256179
* Rewrite the TrailingObjects template to provide two new features:James Y Knight2015-12-181-4/+34
| | | | | | | | | | | | | | - Automatic alignment of the base type for the alignment requirements of the trailing types. - Support for an arbitrary numbers of trailing types, instead of only 1 or 2, by using a variadic template implementation. Upcoming commits to clang will take advantage of both of these features. Differential Revision: http://reviews.llvm.org/D12439 llvm-svn: 256054
* Fix Visual C++ error C2248: Yaron Keren2015-08-061-2/+2
| | | | | | | | | | | | 'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>::additionalSizeToAlloc' : cannot access protected member declared in class 'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>' I'm not sure how this compiles with gcc. Aren't protecteded members accessible only with protected or public inheritance? llvm-svn: 244199
* Add a TrailingObjects template class.James Y Knight2015-08-051-0/+147
This is intended to help support the idiom of a class that has some other objects (or multiple arrays of different types of objects) appended on the end, which is used quite heavily in clang. Differential Revision: http://reviews.llvm.org/D11272 llvm-svn: 244164
OpenPOWER on IntegriCloud