summaryrefslogtreecommitdiff
path: root/unittests/Support
Commit message (Collapse)AuthorAge
* [Allocator] Make BumpPtrAllocator movable and move assignable.Chandler Carruth2014-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206372 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Finally, finish nuking the redundant code that led me hereChandler Carruth2014-04-15
| | | | | | | | | | | | | | | | by removing the MallocSlabAllocator entirely and just using MallocAllocator directly. This makes all off these allocators expose and utilize the same core interface. The only ugly part of this is that it exposes the fact that the JIT allocator has no real handling of alignment, any more than the malloc allocator does. =/ It would be nice to fix both of these to support alignments, and then to leverage that in the BumpPtrAllocator to do less over allocation in order to manually align pointers. But, that's another patch for another day. This patch has no functional impact, it just removes the somewhat meaningless wrapper around MallocAllocator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206267 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Make the underlying allocator a template instead of anChandler Carruth2014-04-14
| | | | | | | | | | | | abstract interface. The only user of this functionality is the JIT memory manager and it is quite happy to have a custom type here. This removes a virtual function call and a lot of unnecessary abstraction from the common case where this is just a *very* thin vaneer around a call to malloc. Hopefully still no functionality changed here. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206149 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Switch the BumpPtrAllocator to use a vector of pointers toChandler Carruth2014-04-14
| | | | | | | | | | | | | | | | | | | | | | | slabs rather than embedding a singly linked list in the slabs themselves. This has a few advantages: - Better utilization of the slab's memory by not wasting 16-bytes at the front. - Simpler allocation strategy by not having a struct packed at the front. - Avoids paging every allocated slab in just to traverse them for deallocating or dumping stats. The latter is the really nice part. Folks have complained from time to time bitterly that tearing down a BumpPtrAllocator, even if it doesn't run any destructors, pages in all of the memory allocated. Now it won't. =] Also resolves a FIXME with the scaling of the slab sizes. The scaling now disregards specially sized slabs for allocations larger than the threshold. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206147 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Allow scalars to dictate quotation rulesDavid Majnemer2014-04-10
| | | | | | | Introduce ScalarTraits::mustQuote which determines whether or not a StringRef needs quoting before it is acceptable to output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205955 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly""David Majnemer2014-04-09
| | | | | | | | | Don't quote octal compatible strings if they are only two wide, they aren't ambiguous. This reverts commit r205857 which reverted r205857. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205914 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "YAMLIO: Encode ambiguous hex strings explicitly"Filipe Cabecinhas2014-04-09
| | | | | | | | This reverts commit r205839. It broke several tests in lld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205857 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Encode ambiguous hex strings explicitlyDavid Majnemer2014-04-09
| | | | | | | | | | YAMLIO would turn a BinaryRef into the string 0000000004000000. However, the leading zero causes parsers to interpret it as being an octal number instead of a hexadecimal one. Instead, escape such strings as needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205839 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify compression API by compressing into a SmallVector rather than a ↵David Blaikie2014-04-05
| | | | | | | | MemoryBuffer This is the other half of r205676. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205677 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify compression API by decompressing into a SmallVector rather than a ↵David Blaikie2014-04-05
| | | | | | | | | | | | MemoryBuffer This avoids an extra copy during decompression and avoids the use of MemoryBuffer which is a weirdly esoteric device that includes unrelated concepts like "file name" (its rather generic name is a bit misleading). Similar refactoring of zlib::compress coming up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205676 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Lift the slab size and size threshold into templateChandler Carruth2014-03-30
| | | | | | | | | | parameters rather than runtime parameters. There is only one user of these parameters and they are compile time for that user. Making these compile time seems to better reflect their intended usage as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205143 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Simplify unittests by using the default size parameters inChandler Carruth2014-03-30
| | | | | | more places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205141 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix these tests on windows.Rafael Espindola2014-03-25
| | | | | | | | | It is impossible to create a hard link to a non existing file, so create a dummy file, create the link an delete the dummy file. On windows one cannot remove the current directory, so chdir first. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204719 91177308-0d34-0410-b5e6-96231b3b80d8
* SupportTests.LockFileManagerTest: Add assertions for Win32.NAKAMURA Takumi2014-03-23
| | | | | | | - create_link doesn't work for nonexistent file. - remove cannot remove working directory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204579 91177308-0d34-0410-b5e6-96231b3b80d8
* Suppress SupportTests.LockFileManagerTest on win32 for investigating.NAKAMURA Takumi2014-03-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204533 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Make sure LockFileManager works correctly with relative paths.Argyrios Kyrtzidis2014-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204426 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Make sure sys::fs::remove can remove symbolic links and make sure ↵Argyrios Kyrtzidis2014-03-21
| | | | | | LockFileManager can handle a symbolic link that points nowhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204422 91177308-0d34-0410-b5e6-96231b3b80d8
* support: add a utility function to normalise path separatorsSaleem Abdulrasool2014-03-11
| | | | | | | | Add a utility function to convert the Windows path separator to Unix style path separators. This is used by a subsequent change in clang to enable the use of Windows SDK headers on Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203611 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup the interface for creating soft or hard links.Rafael Espindola2014-03-11
| | | | | | | | | | | | Before this patch the unix code for creating hardlinks was unused. The code for creating symbolic links was implemented in lib/Support/LockFileManager.cpp and the code for creating hard links in lib/Support/*/Path.inc. The only use we have for these is in LockFileManager.cpp and it can use both soft and hard links. Just have a create_link function that creates one or the other depending on the platform. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203596 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace LLVM-style type traits with C++11 standard ones.Benjamin Kramer2014-03-07
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203242 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-06
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an inconsistency in treatment of trailing / in path::const_iteratorBen Langmuir2014-03-05
| | | | | | | | | When using a //net/ path, we were transforming the trailing / into a '.' when the path was just the root path and we were iterating backwards. Forwards iteration and other kinds of root path (C:\, /) were already correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202999 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add overloads for externally used OwningPtr functions.Ahmed Charles2014-03-05
| | | | | | | | This will allow external callers of these functions to switch over time rather than forcing a breaking change all a once. These particular functions were determined by building clang/lld/lldb. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202959 91177308-0d34-0410-b5e6-96231b3b80d8
* Hey, we can stop depending on the IR library from the Support unittestsChandler Carruth2014-03-04
| | | | | | | now. ;] Tested on both a static and shared CMake build. Hopefully the bots will agree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202844 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move the LeakDetector header into the IR library where theChandler Carruth2014-03-04
| | | | | | | | | | | source file had already been moved. Also move the unittest into the IR unittest library. This may seem an odd thing to put in the IR library but we only really use this with instructions and it needs the LLVM context to work, so it is intrinsically tied to the IR library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202842 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move the ConstantRange class into the IR library. This isChandler Carruth2014-03-04
| | | | | | | | | | a bit surprising, as the class is almost entirely abstracted away from any particular IR, however it encodes the comparsion predicates which mutate ranges as ICmp predicate codes. This is reasonable as they're used for both instructions and constants. Thus, it belongs in the IR library with instructions and constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202838 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Move ValueHandle into the IR library where Value itself lives.Chandler Carruth2014-03-04
| | | | | | | | | | | Move the test for this class into the IR unittests as well. This uncovers that ValueMap too is in the IR library. Ironically, the unittest for ValueMap is useless in the Support library (honestly, so was the ValueHandle test) and so it already lives in the IR unittests. Mmmm, tasty layering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202821 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Switch all uses of the llvm_move macro to use std::moveChandler Carruth2014-03-02
| | | | | | directly, and remove the macro. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202612 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Remove LLVM_HAS_CXX11_STDLIB now that it is just on.Chandler Carruth2014-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202587 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.Chandler Carruth2014-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202583 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the overloaded std::abs rather than C's abs(int) to address Clang's ↵David Blaikie2014-02-26
| | | | | | -Wabsolute-value git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202286 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the F_Binary flag with a F_Text one.Rafael Espindola2014-02-24
| | | | | | | | | After this I will set the default back to F_None. The advantage is that before this patch forgetting to set F_Binary would corrupt a file on windows. Forgetting to set F_Text produces one that cannot be read in notepad, which is a better failure mode :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202052 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix windows unittest I missed in the raw_fd_ostream constructor change.Rafael Espindola2014-02-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202050 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify remove, create_directory and create_directories.Rafael Espindola2014-02-23
| | | | | | | | | | | | | | | Before this patch they would take an boolean argument to say if the path already existed. This was redundant with the returned error_code which is able to represent that. This allowed for callers to incorrectly check only the existed flag instead of first checking the error code. Instead, pass in a boolean flag to say if the previous (non-)existence should be an error or not. Callers of the of the old simple versions are not affected. They still ignore the previous (non-)existence as they did before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201979 91177308-0d34-0410-b5e6-96231b3b80d8
* Move get[S|U]LEB128Size() to LEB128.h.Logan Chien2014-02-22
| | | | | | | | | | | This commit moves getSLEB128Size() and getULEB128Size() from MCAsmInfo to LEB128.h and removes some copy-and-paste code. Besides, this commit also adds some unit tests for the LEB128 functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201937 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove TimeValue::toPosixTime() -- it is buggy, semantics are unclear, and itsDmitri Gribenko2014-02-11
| | | | | | | only current user should be using toEpochTime() instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201136 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix layering StringRef copy using BumpPtrAllocator.Nick Kledzik2014-02-05
| | | | | | | | | | | Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy: StringRef myCopy = myStr.copy(myAllocator); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200885 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence a warning:Chandler Carruth2014-02-04
| | | | | | | | | | | | | | | In file included from ../unittests/Support/ProcessTest.cpp:11: ../utils/unittest/googletest/include/gtest/gtest.h:1448:28: warning: comparison of integers of different signs: 'const unsigned int' and 'const int' [-Wsign-compare] GTEST_IMPL_CMP_HELPER_(NE, !=); ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ ../utils/unittest/googletest/include/gtest/gtest.h:1433:12: note: expanded from macro 'GTEST_IMPL_CMP_HELPER_' if (val1 op val2) {\ ^ ../unittests/Support/ProcessTest.cpp:46:3: note: in instantiation of function template specialization 'testing::internal::CmpHelperNE<unsigned int, int>' requested here EXPECT_NE((r1 | r2), 0); ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200801 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented support for Process::GetRandomNumber on Windows.Aaron Ballman2014-02-04
| | | | | | Patch thanks to Stephan Tolksdorf! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200767 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce llvm::sys::path::home_directory.Peter Collingbourne2014-01-31
| | | | | | | | | This will be used by the line editor library to derive a default path to the history file. Differential Revision: http://llvm-reviews.chandlerc.com/D2199 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200594 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove C++11ism from r200407.Jordan Rose2014-01-29
| | | | | | Oops! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200412 91177308-0d34-0410-b5e6-96231b3b80d8
* [CommandLine] Aliases require an value if their target requires a value.Jordan Rose2014-01-29
| | | | | | | | | This can still be overridden by explicitly setting a value requirement on the alias option, but by default it should be the same. PR18649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200407 91177308-0d34-0410-b5e6-96231b3b80d8
* Add BumpPtrAllocator::allocateCopy() utilitiesNick Kledzik2014-01-28
| | | | | | | Makes it easy to use BumpPtrAllocator to make a copy of StringRef strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200331 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix known typosAlp Toker2014-01-24
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200018 91177308-0d34-0410-b5e6-96231b3b80d8
* Use LLVM_EXPLICIT instead of a function pointer as bool.Rafael Espindola2014-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199437 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove remove_all. A compiler has no need for recursively deleting a directory.Rafael Espindola2014-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198955 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a unit test for the copy constructor.Rafael Espindola2014-01-09
| | | | | | | | I would not normally add tests like these, but the copy constructor is not used at all in our codebase with c++11, so having this tests might prevent breaking the c++03 build again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198886 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getError and remove the error_code operator.Rafael Espindola2014-01-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198799 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-07
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8