summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/ArrayRefTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add makeArrayRef() overload for ArrayRef input (no-op/identity) NFCMehdi Amini2015-09-101-0/+16
| | | | | | | | | | | | | | | The purpose is to allow templated wrapper to work with either ArrayRef or any convertible operation: template<typename Container> void wrapper(const Container &Arr) { impl(makeArrayRef(Arr)); } with Container being a std::vector, a SmallVector, or an ArrayRef. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 247214
* [ArrayRefTest] Work around a GCC 4.8 internal compiler error.Benjamin Kramer2015-08-051-5/+2
| | | | llvm-svn: 244023
* unittests/ADT/ArrayRefTest.cpp: Suppress r243995 on g++-4.8 for now to ↵NAKAMURA Takumi2015-08-051-0/+4
| | | | | | | | | | | | | | | unbreak bots. For example of mingw-w64-g++-4.8.1, llvm/unittests/ADT/ArrayRefTest.cpp: In member function 'virtual void {anonymous}::ArrayRefTest_AllocatorCopy_Test::TestBody()': llvm/unittests/ADT/ArrayRefTest.cpp:56:40: internal compiler error: in count_type_elements, at expr.c:5523 } Array3Src[] = {{"hello"}, {"world"}}; ^ Please submit a full bug report, with preprocessed source if appropriate. llvm-svn: 244017
* [ArrayRef] Make copy use std::uninitialized_copy.Benjamin Kramer2015-08-041-1/+13
| | | | | | | std::copy does not work for non-trivially copyable classes when we're copying into uninitialized memory. llvm-svn: 243995
* Removing spurious semi colons; NFC.Aaron Ballman2015-06-091-1/+1
| | | | llvm-svn: 239399
* ArrayRef: Remove the equals helper with many arguments.Benjamin Kramer2015-03-011-14/+14
| | | | | | | | | | | | | With initializer lists there is a really neat idiomatic way to write this, 'ArrayRef.equals({1, 2, 3, 4, 5})'. Remove the equal method which always had a hard limit on the number of arguments. I considered rewriting it with variadic templates but that's not really a good fit for a function with homogeneous arguments. 'ArrayRef == {1, 2, 3, 4, 5}' would've been even more awesome, but C++11 doesn't allow init lists with binary operators. llvm-svn: 230907
* Correcting the ArrayRef test to not cause use-after-free bugs with ↵Aaron Ballman2015-02-171-3/+5
| | | | | | initializer lists. Should also silence a -Wsign-compare warning accidentally introduced. llvm-svn: 229515
* Adding additional tests to ensure that initializer lists created from return ↵Aaron Ballman2015-02-171-0/+13
| | | | | | values and as function arguments also work as expected. llvm-svn: 229513
* Addressing a post-commit review comment suggesting to avoid using direct ↵Aaron Ballman2015-02-171-1/+1
| | | | | | initialization. llvm-svn: 229512
* I believe we no longer require LLVM_HAS_INITIALIZER_LISTS; it's supported in ↵Aaron Ballman2015-02-171-0/+6
| | | | | | | | MSVC 2013 and GCC. Added a trivial test to ensure the ArrayRef initializer list constructor is called and behaves as expected. If any of the bots complain (perhaps due to an antiquated version of an STL implementation), I will revert. llvm-svn: 229502
* Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ↵Chandler Carruth2015-01-011-35/+0
| | | | | | | | | | | ArrayRef<T*> where T is a base of U. This appears to have broken at least the windows build bots due to compile errors in the predicate that didn't simply supress the overload. I'm not sure what the fix is, and the bots have been broken for a long time now so I'm just reverting until Michael can figure out a fix. llvm-svn: 225064
* Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> ↵Michael Gottesman2014-12-311-0/+35
| | | | | | where T is a base of U. llvm-svn: 225053
* Add some negative (and positive) static_assert checks for ↵David Blaikie2014-08-311-0/+17
| | | | | | ArrayRef-of-pointer conversions introduced in r216709 llvm-svn: 216830
* Add a test for converting ArrayRef<T *> to ArrayRef<const T *>.Craig Topper2014-08-301-0/+10
| | | | llvm-svn: 216821
* ADT: Unit test for ArrayRef::equals change in r215986Duncan P. N. Exon Smith2014-08-191-0/+4
| | | | llvm-svn: 216008
* [ADT] Add a remarkbly useful little helper routine to ArrayRef forChandler Carruth2014-07-271-0/+22
| | | | | | | | | | | | | | | | checking whether the ArrayRef is equal to an explicit list of arguments. This is particularly easy to implement even without variadic templates because ArrayRef happens to be homogeneously typed. As a consequence we can use a "clever" wrapper type and default arguments to capture in a single method many arguments as well as *how many* arguments the user specified. Thanks to Dave Blaikie for helping me pull together this little helper. Suggestions for how to improve or generalize it are of course welcome. I'll be using it immediately in my follow-up patch. =D llvm-svn: 214041
* ADT: Add a drop_back() helper to ArrayRefDavid Majnemer2014-07-051-0/+7
| | | | | | | | The slice(N, M) interface is powerful but not concise when wanting to drop a few elements off of an ArrayRef, fix this by adding a drop_back method. llvm-svn: 212370
* Fix layering StringRef copy using BumpPtrAllocator.Nick Kledzik2014-02-051-0/+33
Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy: StringRef myCopy = myStr.copy(myAllocator); llvm-svn: 200885
OpenPOWER on IntegriCloud