summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
...
* [ARM] Enable objdump to construct triple for ARMSam Parker2017-01-131-0/+1
| | | | | | | | | | | | | Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Differential Revision: https://reviews.llvm.org/D28281 llvm-svn: 291898
* TarWriter: Fix a bug in Ustar header.Rui Ueyama2017-01-091-1/+2
| | | | | | | | | | If we split a filename into `Name` and `Prefix`, `Prefix` is at most 145 bytes. We had a bug that didn't split a path correctly. This bug was pointed out by Rafael in the post commit review. This patch adds a unit test for TarWriter to verify the fix. llvm-svn: 291494
* Allow setting multiple debug typesEugene Leviant2016-12-271-0/+1
| | | | | | Differential revision: https://reviews.llvm.org/D28109 llvm-svn: 290597
* Move GlobPattern class from LLD to llvm/Support.Rui Ueyama2016-12-201-1/+2
| | | | | | | | | | GlobPattern is a class to handle glob pattern matching. Currently only LLD is using that, but technically that feature is not specific to linkers, so in this patch I move that file to LLVM. Differential Revision: https://reviews.llvm.org/D27969 llvm-svn: 290212
* Use trigrams to speed up SpecialCaseList.Ivan Krasin2016-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: it's often the case when the rules in the SpecialCaseList are of the form hel.o*bar. That gives us a chance to build trigram index to quickly discard 99% of inputs without running a full regex. A similar idea was used in Google Code Search as described in the blog post: https://swtch.com/~rsc/regexp/regexp4.html The check is defeated, if there's at least one regex more complicated than that. In this case, all inputs will go through the regex. That said, the real-world rules are often simple or can be simplied. That considerably speeds up compiling Chromium with CFI and UBSan. As measured on Chromium's content_message_generator.cc: before, CFI: 44 s after, CFI: 23 s after, CFI, no blacklist: 23 s (~1% slower, but 3 runs were unable to show the difference) after, regular compilation to bitcode: 23 s Reviewers: pcc Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D27188 llvm-svn: 288303
* Remove TimeValue classPavel Labath2016-11-161-1/+0
| | | | | | | | | | | | | | Summary: All uses have been replaced by appropriate std::chrono types, and the class is now unused. Reviewers: zturner, mehdi_amini Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26447 llvm-svn: 287094
* [Support] Introduce llvm::formatv() function.Zachary Turner2016-11-111-0/+1
| | | | | | | | | | | | | | | | | | This introduces a new type-safe general purpose formatting library. It provides compile-time type safety, does not require a format specifier (since the type is deduced), and provides mechanisms for extending the format capability to user defined types, and overriding the formatting behavior for existing types. This patch additionally adds documentation for the API to the LLVM programmer's manual. Mailing List Thread: http://lists.llvm.org/pipermail/llvm-dev/2016-October/105836.html Differential Revision: https://reviews.llvm.org/D25587 llvm-svn: 286682
* Support: Remove MemoryObject and DataStreamer interfaces.Peter Collingbourne2016-11-021-1/+0
| | | | | | | | These interfaces are no longer used. Differential Revision: https://reviews.llvm.org/D26222 llvm-svn: 285774
* Resubmit "Add support for advanced number formatting."Zachary Turner2016-10-291-0/+1
| | | | | | | | | | | | | This resubmits r284436 and r284437, which were reverted in r284462 as they were breaking the AArch64 buildbot. The breakage on AArch64 turned out to be a miscompile which is still not fixed, but is actively tracked at llvm.org/pr30748. This resubmission re-writes the code in a way so as to make the miscompile not happen. llvm-svn: 285483
* Reapply "Add Chrono.h - std::chrono support header"Pavel Labath2016-10-201-0/+1
| | | | | | | | | This is a resubmission of r284590. The mingw build should be fixed now. The problem was we were matching time_t with _localtime_64s, which was incorrect on _USE_32BIT_TIME_T systems. Instead I use localtime_s, which should always evaluate to the correct function. llvm-svn: 284720
* Revert "Add Chrono.h - std::chrono support header"Pavel Labath2016-10-191-1/+0
| | | | | | | | | This reverts commit r284590 as it fails on the mingw buildbot. I think I know the fix, but I cannot test it right now. Will reapply when I verify it works ok. This reverts r284590. llvm-svn: 284615
* Add Chrono.h - std::chrono support headerPavel Labath2016-10-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: std::chrono mostly covers the functionality of llvm::sys::TimeValue and lldb_private::TimeValue. This header adds a bit of utility functions and typedefs, which make the usage of the library and porting code from TimeValues easier. Rationale: - TimePoint typedef - precision of system_clock is implementation defined - using a well-defined precision helps maintain consistency between platforms, makes it interact better with existing TimeValue classes, and avoids cases there a time point is implicitly convertible to a specific precision on some platforms but not on others. - system_clock::to_time_t only accepts time_points with the default system precision (even though time_t has only second precision on all platforms we support). To avoid the need for explicit casts, I have added a toTimeT() wrapper function. toTimePoint(time_t) was not strictly necessary, but I have added it for symmetry. Reviewers: zturner, mehdi_amini Subscribers: beanz, mgorny, llvm-commits, modocache Differential Revision: https://reviews.llvm.org/D25416 llvm-svn: 284590
* Revert "Resubmit "Add support for advanced number formatting.""Renato Golin2016-10-181-1/+0
| | | | | | | | | | This reverts commits 284436 and 284437 because they still break AArch64 bots: Value of: format_number(-10, IntegerStyle::Integer, 1) Actual: "-0" Expected: "-10" llvm-svn: 284462
* Resubmit "Add support for advanced number formatting."Zachary Turner2016-10-171-0/+1
| | | | | | | | | | This resubmits commits 284425 and r284428, which were reverted in r284429 due to some infinite recursion caused by an incorrect selection of function overloads. Reproduced the failure on Linux using GCC 4.8.4, and confirmed that with the new patch the tests path on GCC as well as MSVC. So hopefully this fixes everything. llvm-svn: 284436
* Revert formatting changes.Zachary Turner2016-10-171-1/+0
| | | | | | | This reverts r288425 and r284428 as they are causing test crashes on some systems. llvm-svn: 284429
* [Support] Add support for "advanced" number formatting.Zachary Turner2016-10-171-0/+1
| | | | | | | | | | | | | | | raw_ostream has not afforded a lot of flexibility in terms of how to format numbers when outputting. Wrap this all up into a set of low level helper functions that can be used to output numbers with arbitrary precision, alignment, format, etc and then update raw_ostream to use these functions. This will be useful for upcoming improvements to llvm's string formatting libraries, but are still useful independently. Differential Revision: https://reviews.llvm.org/D25497 llvm-svn: 284425
* Add interface for querying physical hardware concurrencyTeresa Johnson2016-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: This will be used by ThinLTO to set the amount of backend parallelism, which performs better when restricted to the number of physical cores (on X86 at least, where getHostNumPhysicalCores is currently defined). If not available this falls back to thread::hardware_concurrency. Note I didn't add to the thread class since that is a typedef to std::thread where available. Reviewers: mehdi_amini Subscribers: beanz, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D25585 llvm-svn: 284180
* Add interface to compute number of physical cores on host systemTeresa Johnson2016-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: For now I have only added support for x86_64 Linux, but other systems can be added incrementally. This is to be used for setting the default parallelism for ThinLTO backends (instead of thread::hardware_concurrency which includes hyperthreading and is too aggressive). I'll send this as a follow-on patch, and it will fall back to hardware_concurrency when the new getHostNumPhysicalCores returns -1 (when not supported for a given host system). I also added an interface to MemoryBuffer to force reading a file as a stream - this is required for /proc/cpuinfo which is a special file that looks like a normal file but appears to have 0 size. The existing readers of this file in Host.cpp are reading the first 1024 or so bytes from it, because the necessary info is near the top. But for the new functionality we need to be able to read the entire file. I can go back and change the other readers to use the new getFileAsStream as a follow-on patch since it seems much more robust. Added a unittest. Reviewers: mehdi_amini Subscribers: beanz, mgorny, llvm-commits, modocache Differential Revision: https://reviews.llvm.org/D25564 llvm-svn: 284138
* Add xxhash to llvm.Rafael Espindola2016-09-271-0/+1
| | | | | | It will be used for fast fingerprinting in lld at least. llvm-svn: 282493
* Move unittests/Support/IteratorTest.cpp to unittests/ADT/Duncan P. N. Exon Smith2016-08-201-1/+0
| | | | | | This testing stuff from ADT, not Support. Fix the file location. llvm-svn: 279372
* Add support for computing SHA1 in LLVMMehdi Amini2016-04-011-0/+1
| | | | | | | | | | | | | | | | Provide a class to generate a SHA1 from a sequence of bytes, and a convenience raw_ostream adaptor. This will be used to provide a "build-id" by hashing the Module block when writing bitcode. ThinLTO will use this information for incremental build. Reapply r265094 which was reverted in r265102 because it broke MSVC bots (constexpr is not supported). http://reviews.llvm.org/D16325 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265107
* Revert "Add support for computing SHA1 in LLVM"Mehdi Amini2016-04-011-1/+0
| | | | | | | | This reverts commit r265096, r265095, and r265094. Windows build is broken, and the validation does not pass. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265102
* Add support for computing SHA1 in LLVMMehdi Amini2016-04-011-0/+1
| | | | | | | | | | | Provide a class to generate a SHA1 from a sequence of bytes, and a convenience raw_ostream adaptor. This will be used to provide a "build-id" by hashing the Module block when writing bitcode. ThinLTO will use this information for incremental build. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265094
* Support: Move StreamingMemoryObject{,Test}.cpp, NFCDuncan P. N. Exon Smith2016-03-271-1/+1
| | | | | | | | Change the filename to indicate this is a test, rename the tests, move them into an anonymous namespace, and rename some variables. All to match our usual style before making further changes. llvm-svn: 264548
* [Support] Add the 'Error' class for structured error handling.Lang Hames2016-03-161-0/+1
| | | | | | | | | | | | | | | | | This patch introduces the Error classs for lightweight, structured, recoverable error handling. It includes utilities for creating, manipulating and handling errors. The scheme is similar to exceptions, in that errors are described with user-defined types. Unlike exceptions however, errors are represented as ordinary return types in the API (similar to the way std::error_code is used). For usage notes see the LLVM programmer's manual, and the Error.h header. Usage examples can be found in unittests/Support/ErrorTest.cpp. Many thanks to David Blaikie, Mehdi Amini, Kevin Enderby and others on the llvm-dev and llvm-commits lists for lots of discussion and review. llvm-svn: 263609
* unitests: add some ARM TargetParser testsSaleem Abdulrasool2016-03-061-0/+1
| | | | | | | | | The ARM TargetParser would construct invalid StringRefs. This would cause asserts to trigger. Add some tests in LLVM to ensure that we dont regress on this in the future. Although there is a test for this in clang, this ensures that the changes would get caught in the same repository. llvm-svn: 262790
* Refactor duplicated code for linking with pthread.Rafael Espindola2016-03-011-3/+1
| | | | llvm-svn: 262344
* [Support] Add a fancy helper function to get a static name for a type.Chandler Carruth2016-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This extracts the type name from __PRETTY_FUNCTION__ for compilers that support it (I've opted Clang, GCC, and ICC into this as I've tested that they work) and from __FUNCSIG__ which is very similar on MSVC. The routine falls back gracefully on a stub "UNKNOWN_TYPE" string with compilers or formats it doesn't understand. This should be enough for a lot of common cases in LLVM where the real goal is just to log or print a type name as a debugging aid, and save a ton of boilerplate in the process. Notably, I'm planning to use this to remove all the getName() boiler plate from the new pass manager. The design and implementation is based on a bunch of advice and discussion with Richard Smith and experimenting with most versions of Clang and GCC. David Majnemer also provided excellent advice on how best to do this with MSVC. Richard also checked that ICC does something reasonable and I'll watch the build bots for other compilers. It'd be great if someone could contribute logic for xlC and/or other toolchains. Differential Revision: http://reviews.llvm.org/D17565 llvm-svn: 261819
* [unittests] Move TargetRegistry test from Support to MCReid Kleckner2016-02-031-2/+0
| | | | | | | This removes the dependency from SupportTests to all of the LLVM backends, and makes it link faster. llvm-svn: 259705
* [Support] Allow multiple paired calls to {start,stop}Timer()Vedant Kumar2015-12-221-0/+1
| | | | | | | Differential Revision: http://reviews.llvm.org/D15619 Reviewed-by: rafael llvm-svn: 256258
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by: http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable Recommit of r255589, trying to please g++ as well. Differential Revision: http://reviews.llvm.org/D15464 From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8> llvm-svn: 255593
* Revert "Add a C++11 ThreadPool implementation in LLVM"Mehdi Amini2015-12-151-1/+0
| | | | | | | This reverts commit r255589. Breaks g++ From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255591
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by: http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable Differential Revision: http://reviews.llvm.org/D15464 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255589
* Revert r255444.Nico Weber2015-12-131-1/+0
| | | | | | | | It doesn't build on Windows and broke the Windows LLD and LLDB bots: http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/27693/steps/build_Lld/logs/stdio http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc/builds/13468/steps/build/logs/stdio llvm-svn: 255446
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-121-0/+1
| | | | | | | | | | | | | | | | | | This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. Differential Revision: http://reviews.llvm.org/D15464 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255444
* Fix rename() sometimes failing if another process uses openFileForRead()Greg Bedwell2015-10-121-0/+1
| | | | | | | | | | | | | | | | | | | On Windows, fs::rename() could fail is another process was reading the file at the same time using fs::openFileForRead(). In most cases the user wouldn't notice as fs::rename() will continue to retry for 2000ms. Typically this is enough for the read to complete and a retry to succeed, but if the disk is being it too hard then the response time might be longer than the retry time and the rename would fail with a permission error. Add FILE_SHARE_DELETE to the sharing flags for CreateFileW() in fs::openFileForRead() and try ReplaceFileW() prior to MoveFileExW() in fs::rename(). Based on an initial patch by Edd Dawson! Differential Revision: http://reviews.llvm.org/D13647 llvm-svn: 250046
* Add a TrailingObjects template class.James Y Knight2015-08-051-0/+1
| | | | | | | | | | 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
* Prevent further errors of omission when adding backend names.Douglas Katzman2015-05-081-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D9441 llvm-svn: 236865
* Add raw_pwrite_stream type.Rafael Espindola2015-04-141-0/+1
| | | | | | | This is a raw_ostream that also supports pwrite. I will be used in a sec. llvm-svn: 234895
* Add support for double / float to EndianStreamMatt Arsenault2015-02-051-0/+1
| | | | | | Also add new unit tests for endian::Writer llvm-svn: 228269
* Support: Stop stringifying DW_TAG_{lo,hi}_userDuncan P. N. Exon Smith2015-02-031-0/+1
| | | | | | | | `dwarf::TagString()` shouldn't stringify `DW_TAG_lo_user` or `DW_TAG_hi_user`. These aren't actual tags; they're markers for the edge of vendor-specific tag regions. llvm-svn: 228029
* Fix a silly bug in StreamingMemoryObject.cpp.Rafael Espindola2014-11-211-0/+1
| | | | | | | The logic for detecting EOF was wrong and would fail if we ever requested more than 16k past the last read position. llvm-svn: 222505
* [CMake] LLVMSupport: Give system_libs PRIVATE scope when LLVMSupport is ↵NAKAMURA Takumi2014-11-071-0/+5
| | | | | | | | built as SHARED. Users of LLVMSupport won't inherit ${system_libs}. unittests/SupporTests is another user of libpthreads. Apply LLVM_SYSTEM_LIBS for him explicitly. llvm-svn: 221531
* Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics.Alexey Samsonov2014-07-091-0/+1
| | | | | | | | | | | | | | | | Turn llvm::SpecialCaseList into a simple class that parses text files in a specified format and knows nothing about LLVM IR. Move this class into LLVMSupport library. Implement two users of this class: * DFSanABIList in DFSan instrumentation pass. * SanitizerBlacklist in Clang CodeGen library. The latter will be modified to use actual source-level information from frontend (source file names) instead of unstable LLVM IR things (LLVM Module identifier). Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils. No functionality change. llvm-svn: 212643
* Support: Write ScaledNumbers::getRounded()Duncan P. N. Exon Smith2014-06-201-0/+1
| | | | | | | | | | | Start extracting helper functions out of -block-freq's `UnsignedFloat` into `Support/ScaledNumber.h` with the eventual goal of moving and renaming the class to `ScaledNumber`. The bike shed about names is still being painted, but I'm going with this for now. llvm-svn: 211333
* PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad ↵Nikola Smiljanic2014-06-191-0/+1
| | | | | | | | OR-result. Mark conversion operator explicit and const qualify comparison operators. llvm-svn: 211244
* Support: Add unit tests for BranchProbabilityDuncan P. N. Exon Smith2014-04-291-0/+1
| | | | llvm-svn: 207540
* [ADT] Add a generic iterator utility for adapting iterators much likeChandler Carruth2014-04-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Boost's iterator_adaptor, and a specific adaptor which iterates over pointees when wrapped around an iterator over pointers. This is the result of a long discussion on IRC with Duncan Smith, Dave Blaikie, Richard Smith, and myself. Essentially, I could use some subset of the iterator facade facilities often used from Boost, and everyone seemed interested in having the functionality in a reasonably generic form. I've tried to strike a balance between the pragmatism and the established Boost design. The primary differences are: 1) Delegating to the standard iterator interface names rather than special names that then make up a second iterator-like API. 2) Using the name 'pointee_iterator' which seems more clear than 'indirect_iterator'. The whole business of calling the '*p' operation 'pointer indirection' in the standard is ... quite confusing. And 'dereference' is no better of a term for moving from a pointer to a reference. Hoping Duncan, and others continue to provide comments on this until we've got a nice, minimal abstraction. llvm-svn: 207069
* Hey, we can stop depending on the IR library from the Support unittestsChandler Carruth2014-03-041-1/+0
| | | | | | | now. ;] Tested on both a static and shared CMake build. Hopefully the bots will agree. llvm-svn: 202844
* [Modules] Move the LeakDetector header into the IR library where theChandler Carruth2014-03-041-1/+0
| | | | | | | | | | | 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. llvm-svn: 202842
OpenPOWER on IntegriCloud