summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix layering StringRef copy using BumpPtrAllocator.Nick Kledzik2014-02-051-28/+0
| | | | | | | | | Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy: StringRef myCopy = myStr.copy(myAllocator); llvm-svn: 200885
* Silence a warning:Chandler Carruth2014-02-041-1/+1
| | | | | | | | | | | | | | | 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); ^ llvm-svn: 200801
* Implemented support for Process::GetRandomNumber on Windows.Aaron Ballman2014-02-041-0/+7
| | | | | | Patch thanks to Stephan Tolksdorf! llvm-svn: 200767
* Introduce llvm::sys::path::home_directory.Peter Collingbourne2014-01-311-0/+13
| | | | | | | | | 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 llvm-svn: 200594
* Remove C++11ism from r200407.Jordan Rose2014-01-291-1/+1
| | | | | | Oops! llvm-svn: 200412
* [CommandLine] Aliases require an value if their target requires a value.Jordan Rose2014-01-291-2/+53
| | | | | | | | | This can still be overridden by explicitly setting a value requirement on the alias option, but by default it should be the same. PR18649 llvm-svn: 200407
* Add BumpPtrAllocator::allocateCopy() utilitiesNick Kledzik2014-01-281-0/+28
| | | | | | Makes it easy to use BumpPtrAllocator to make a copy of StringRef strings. llvm-svn: 200331
* Fix known typosAlp Toker2014-01-242-38/+38
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. llvm-svn: 200018
* Use LLVM_EXPLICIT instead of a function pointer as bool.Rafael Espindola2014-01-161-1/+3
| | | | llvm-svn: 199437
* Remove remove_all. A compiler has no need for recursively deleting a directory.Rafael Espindola2014-01-103-5/+22
| | | | llvm-svn: 198955
* Add a unit test for the copy constructor.Rafael Espindola2014-01-091-0/+3
| | | | | | | | 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. llvm-svn: 198886
* Use getError and remove the error_code operator.Rafael Espindola2014-01-081-1/+1
| | | | llvm-svn: 198799
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-076-8/+3
| | | | | | | | | | 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. llvm-svn: 198685
* Make llvm::Regex non-copyable but movable.David Blaikie2014-01-021-0/+15
| | | | | | Based on a patch by Maciej Piechotka. llvm-svn: 198334
* Introduce a simple line-by-line iterator type into the Support library.Chandler Carruth2013-12-272-0/+116
| | | | | | | | | | | | | | | | | | | This is an iterator which you can build around a MemoryBuffer. It will iterate through the non-empty, non-comment lines of the buffer as a forward iterator. It should be small and reasonably fast (although it could be made much faster if anyone cares, I don't really...). This will be used to more simply support the text-based sample profile file format, and is largely based on the original patch by Diego. I've re-worked the style of it and separated it from the work of producing a MemoryBuffer from a file which both simplifies the interface and makes it easier to test. The style of the API follows the C++ standard naming conventions to fit in better with iterators in general, much like the Path and FileSystem interfaces follow standard-based naming conventions. llvm-svn: 198068
* unittests/Support/ProcessTest.cpp: Don't use "windows.h". Use <windows.h> ↵NAKAMURA Takumi2013-12-251-1/+1
| | | | | | instead. llvm-svn: 198011
* Make sys::ThreadLocal<> zero-initialized on non-thread builds (PR18205)Hans Wennborg2013-12-192-0/+39
| | | | | | | | | | | | | According to the docs, ThreadLocal<>::get() should return NULL if no object has been set. This patch makes that the case also for non-thread builds and adds a very basic unit test to check it. (This was causing PR18205 because PrettyStackTraceHead didn't get zero- initialized and we'd crash trying to read past the end of that list. We didn't notice this so much on Linux since we'd crash after printing all the entries, but on Mac we print into a SmallString, and would crash before printing that.) llvm-svn: 197718
* [block-freq] Add a right shift to BlockFrequency that saturates at 1.Michael Gottesman2013-12-141-0/+8
| | | | llvm-svn: 197302
* Swap around EXPECT_EQ() arguments orders for more natural gtest Failure messagesAlp Toker2013-12-121-8/+8
| | | | | | | | | Somewhat counterintuitively the first arg in gtest is treated as the expectation. No change to the tests themselves. llvm-svn: 197124
* Add missing escape characters to the new Regex::escape() functionAlp Toker2013-12-121-0/+5
| | | | | | | | | The old AddFixedStringToRegEx() it was based on got away with this for the longest time, but the problem became easy to spot after the cleanup in r197096. Also add a quick unit test to cover regex escaping. llvm-svn: 197121
* [block-freq] Update data in test case to be unsigned long long to fix mingw ↵Michael Gottesman2013-11-221-80/+80
| | | | | | build. llvm-svn: 195411
* YAML I/O add support for validate()Nick Kledzik2013-11-211-3/+43
| | | | | | | MappingTrait template specializations can now have a validate() method which performs semantic checking. For details, see <http://llvm.org/docs/YamlIO.html>. llvm-svn: 195286
* revert r194655Nick Kledzik2013-11-211-70/+0
| | | | llvm-svn: 195285
* YAML I/O - Added default trait support for std:string. Making another ↵John Thompson2013-11-191-0/+31
| | | | | | attempt at this, this time doing a clean build on Linux, and running the LLVM, clang, and extra tests, to try to make sure there's no problems. llvm-svn: 195134
* Recover gracefully when deserializing invalid YAML input.Alexander Kornienko2013-11-181-46/+116
| | | | | | | | | Fixes http://llvm.org/PR16221, http://llvm.org/PR15927 Phabricator: http://llvm-reviews.chandlerc.com/D1236 Patch by Andrew Tulloch! llvm-svn: 195016
* [block-freq] Add BlockFrequency::scale that returns a remainder from the ↵Michael Gottesman2013-11-171-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | division and make the private scale in BlockFrequency more performant. This change is the first in a series of changes improving LLVM's Block Frequency propogation implementation to not lose probability mass in branchy code when propogating block frequency information from a basic block to its successors. This patch is a simple infrastructure improvement that does not actually modify the block frequency algorithm. The specific changes are: 1. Changes the division algorithm used when scaling block frequencies by branch probabilities to a short division algorithm. This gives us the remainder for free as well as provides a nice speed boost. When I benched the old routine and the new routine on a Sandy Bridge iMac with disabled turbo mode performing 8192 iterations on an array of length 32768, I saw ~600% increase in speed in mean/median performance. 2. Exposes a scale method that returns a remainder. This is important so we can ensure that when we scale a block frequency by some branch probability BP = N/D, the remainder from the division by D can be retrieved and propagated to other children to ensure no probability mass is lost (more to come on this). llvm-svn: 194950
* Path: Recognize COFF import library file magic.Rui Ueyama2013-11-151-0/+2
| | | | | | | | | | | | Summary: Make identify_magic to recognize COFF import file. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2165 llvm-svn: 194852
* Recognize 0x0000 as a COFF file magic.Rui Ueyama2013-11-141-0/+2
| | | | | | | | | | | | | | | Summary: Some machine-type-neutral object files containing only undefined symbols actually do exist in the Windows standard library. Need to recognize them as COFF files. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2164 llvm-svn: 194734
* remove extra semicolonNick Kledzik2013-11-141-1/+1
| | | | llvm-svn: 194658
* Add dyn_cast<> support to YAML I/O's IO classNick Kledzik2013-11-141-0/+70
| | | | llvm-svn: 194655
* Add simple support for tags in YAML I/ONick Kledzik2013-11-141-0/+85
| | | | llvm-svn: 194644
* Path: Add tests for existing file magics.Rui Ueyama2013-11-131-6/+36
| | | | llvm-svn: 194607
* Whitespace.Rui Ueyama2013-11-131-3/+3
| | | | llvm-svn: 194605
* Simplify ErrorOr.Rafael Espindola2013-11-051-38/+0
| | | | | | | | | | | | | | | | ErrorOr had quiet a bit of complexity and indirection to be able to hold a user type with the error. That feature is not used anymore. This patch removes it, it will live in svn history if we ever need it again. If we do need it again, IMHO there is one thing that should be done differently: Holding extra info in the error is not a property a function also returning a value or not. The ability to hold extra info should be in the error type and ErrorOr templated over it so that we don't need the funny looking ErrorOr<void>. llvm-svn: 194030
* make ConstantRange::signExtend() optimalNuno Lopes2013-10-301-0/+3
| | | | | | the case [x, INT_MIN) was not handled optimally llvm-svn: 193694
* Try to fix the build on windows.Rafael Espindola2013-10-251-2/+2
| | | | llvm-svn: 193431
* Change MemoryBuffer::getFile to take a Twine.Rafael Espindola2013-10-251-1/+1
| | | | llvm-svn: 193429
* Reverting my r193344 checkin due to build breakage.John Thompson2013-10-241-31/+0
| | | | llvm-svn: 193350
* Added std::string as a built-in type for mapping.John Thompson2013-10-241-0/+31
| | | | llvm-svn: 193344
* Add non-blocking Wait() for launched processesTareq A. Siraj2013-10-011-0/+103
| | | | | | | | | | | | | | | | | - New ProcessInfo class to encapsulate information about child processes. - Generalized the Wait() to support non-blocking wait on child processes. - ExecuteNoWait() now returns a ProcessInfo object with information about the launched child. Users will be able to use this object to perform non-blocking wait. - ExecuteNoWait() now accepts an ExecutionFailed param that tells if execution failed or not. These changes will allow users to implement basic process parallel tools. Differential Revision: http://llvm-reviews.chandlerc.com/D1728 llvm-svn: 191763
* SourceMgr diagnotics printing: fix a bug where printing a fixit for a sourceDmitri Gribenko2013-09-271-0/+12
| | | | | | | range that includes a tab character will cause out-of-bounds access to the fixit string. llvm-svn: 191563
* Make SourceMgr::PrintMessage() testable and add unit testsDmitri Gribenko2013-09-272-0/+163
| | | | llvm-svn: 191558
* Fixed typo in CreateProcessTrailingSlash testTareq A. Siraj2013-09-201-1/+1
| | | | | | | | --gtest_filter was filtering an invalid name for the test. Differential Revision: http://llvm-reviews.chandlerc.com/D1733 llvm-svn: 191100
* Re-submit r190469: YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-0/+57
| | | | llvm-svn: 190485
* Revert "YAMLIO: Fix string quoting logic." (r190469)Hans Wennborg2013-09-111-57/+0
| | | | | | It was turning the buildbots red. llvm-svn: 190480
* Remove trailing whitespaceRui Ueyama2013-09-111-3/+3
| | | | llvm-svn: 190472
* YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-0/+57
| | | | | | | | YAMLIO printed a string as is without quotes unless it contains a newline character. That did not suffice. We also need to quote a string if it starts with a backquote, quote, double quote or atsign, or it's the empty string. llvm-svn: 190469
* Try to unbreak mingw32 buildbot.Rui Ueyama2013-09-101-2/+2
| | | | llvm-svn: 190438
* Add getenv() wrapper that works on multibyte environment variable.Rui Ueyama2013-09-101-0/+28
| | | | | | | | | | | | | | | | | | On Windows, character encoding of multibyte environment variable varies depending on settings. The only reliable way to handle it I think is to use GetEnvironmentVariableW(). GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16 string. That's not ideal because we use UTF-8 as the internal encoding in LLVM. This patch defines a wrapper function which takes and returns UTF-8 string for GetEnvironmentVariableW(). The wrapper function does not do any conversion and just forwards the argument to getenv() on Unix. Differential Revision: http://llvm-reviews.chandlerc.com/D1612 llvm-svn: 190423
* Update CMake file to fix buildbots.Bob Wilson2013-09-091-1/+0
| | | | llvm-svn: 190331
OpenPOWER on IntegriCloud