summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [Support] Rewrite handleAllErrors in terms of cantFail.Lang Hames2017-08-241-2/+3
| | | | | | | | This just switches handleAllErrors from using custom assertions that all errors have been handled to using cantFail. This change involves moving some of the class and function definitions around though. llvm-svn: 311631
* [ARM][AArch64] Add Armv8.3-a unittestsSam Parker2017-08-221-4/+10
| | | | | | | | Add Armv8.3-A to the architecture to the TargetParser unittests. Differential Revision: https://reviews.llvm.org/D36748 llvm-svn: 311450
* [Support, Windows] Handle long paths with unix separatorsPirama Arumuga Nainar2017-08-211-0/+15
| | | | | | | | | | | | | | | | | | Summary: The function widenPath() for Windows also normalizes long path names by iterating over the path's components and calling append(). The assumption during the iteration that separators are not returned by the iterator doesn't hold because the iterators do return a separator when the path has a drive name. Handle this case by ignoring separators during iteration. Reviewers: rnk Subscribers: danalbert, srhines Differential Revision: https://reviews.llvm.org/D36752 llvm-svn: 311382
* [ARM][AArch64] Cortex-A75 and Cortex-A55 supportSam Parker2017-08-211-2/+34
| | | | | | | | | | | | | | | | | | This patch introduces support for Cortex-A75 and Cortex-A55, Arm's latest big.LITTLE A-class cores. They implement the ARMv8.2-A architecture, including the cryptography and RAS extensions, plus the optional dot product extension. They also implement the RCpc AArch64 extension from ARMv8.3-A. Cortex-A75: https://developer.arm.com/products/processors/cortex-a/cortex-a75 Cortex-A55: https://developer.arm.com/products/processors/cortex-a/cortex-a55 Differential Revision: https://reviews.llvm.org/D36667 llvm-svn: 311316
* [Support] env vars with empty values on windowsBen Dunbobbin2017-08-181-1/+9
| | | | | | | | | | | | | | | | An environment variable can be in one of three states: 1. undefined. 2. defined with a non-empty value. 3. defined but with an empty value. The windows implementation did not support case 3 (it was not handling errors). The Linux implementation is already correct. Differential Revision: https://reviews.llvm.org/D36394 llvm-svn: 311174
* [Support] PR33388 - Fix formatv_object move constructorBenoit Belley2017-08-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | formatv_object currently uses the implicitly defined move constructor, but it is buggy. In typical use-cases, the problem doesn't show-up because all calls to the move constructor are elided. Thus, the buggy constructors are never invoked. The issue especially shows-up when code is compiled using the -fno-elide-constructors compiler flag. For instance, this is useful when attempting to collect accurate code coverage statistics. The exact issue is the following: The Parameters data member is correctly moved, thus making the parameters occupy a new memory location in the target object. Unfortunately, the default copying of the Adapters blindly copies the vector of pointers, leaving each of these pointers referencing the parameters in the original object instead of the copied one. These pointers quickly become dangling when the original object is deleted. This quickly leads to crashes. The solution is to update the Adapters pointers when performing a move. The copy constructor isn't useful for format objects and can thus be deleted. This resolves PR33388. Differential Revision: https://reviews.llvm.org/D34463 llvm-svn: 310475
* [Support] Remove getPathFromOpenFD, it was unusedReid Kleckner2017-08-041-90/+0
| | | | | | | | | | | | | | Summary: It was added to support clang warnings about includes with case mismatches, but it ended up not being necessary. Reviewers: twoh, rafael Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D36328 llvm-svn: 310078
* [Support/GlobPattern] - Do not crash when pattern has characters with int ↵George Rimar2017-07-311-0/+9
| | | | | | | | | | | | | | | value < 0. Found it during work on LLD, it would crash on following linker script: SECTIONS { .foo : { *("*®") } } That happens because ® has int value -82. And chars are used as array index in code, and are signed by default. Differential revision: https://reviews.llvm.org/D35891 llvm-svn: 309549
* [TargetParser] Use enum classes for various ARM kind enums.Florian Hahn2017-07-271-143/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Using c++11 enum classes ensures that only valid enum values are used for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the need for checks that the provided values map to a proper enum value, allows us to get rid of AK_LAST and prevents comparing values from different enums. It also removes a bunch of static_cast from unsigned to enum values and vice versa, at the cost of introducing static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind. FPUKind and ArchExtKind are the only remaining old-style enum in TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style enum, but FPUKind can be converted too, but this patch is quite big, so could do this in a follow-up patch. I could also split this patch up a bit, if people would prefer that. Reviewers: rengolin, javed.absar, chandlerc, rovka Reviewed By: rovka Subscribers: aemerson, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D35882 llvm-svn: 309287
* [YAMLTraits] Add filename support to yaml::InputAlex Bradbury2017-07-171-0/+16
| | | | | | | | | | | | | | | | | | | Summary: The current yaml::Input constructor takes a StringRef of data as its first parameter, discarding any filename information that may have been present when a YAML file was opened. Add an alterate yaml::Input constructor that takes a MemoryBufferRef, which can have a filename associated with it. This leads to clearer diagnostic messages. Sponsored By: DARPA, AFRL Reviewed By: arphaman Differential Revision: https://reviews.llvm.org/D35398 Patch by: Jonathan Anderson (trombonehero) llvm-svn: 308172
* Support: Add llvm::center_justify.Frederich Munch2017-07-131-0/+5
| | | | | | | | | | | | | | Summary: Completes the set. Reviewers: ruiu Reviewed By: ruiu Subscribers: ruiu, llvm-commits Differential Revision: https://reviews.llvm.org/D35278 llvm-svn: 307922
* [AArch64] Add an SVE target feature to the backend and TargetParser.Amara Emerson2017-07-131-2/+3
| | | | | | | The feature will be used properly once assembler/disassembler support begins to land. llvm-svn: 307917
* Allow clients to specify search order of DynamicLibraries.Frederich Munch2017-07-121-0/+10
| | | | | | | | | | | | | | Summary: Different JITs and other clients of LLVM may have different needs in how symbol resolution should occur. Reviewers: v.g.vassilev, lhames, karies Reviewed By: v.g.vassilev Subscribers: pcanal, llvm-commits Differential Revision: https://reviews.llvm.org/D33529 llvm-svn: 307849
* fix typos in comments; NFCHiroshi Inoue2017-07-111-1/+1
| | | | llvm-svn: 307626
* [Support] sys::getProcessTriple should return a macOS triple usingAlex Lorenz2017-07-071-0/+61
| | | | | | | | | | | | | | | the system's version of macOS sys::getProcessTriple returns LLVM_HOST_TRIPLE, whose system version might not be the actual version of the system on which the compiler running. This commit ensures that, for macOS, sys::getProcessTriple returns a triple with the system's macOS version. rdar://33177551 Differential Revision: https://reviews.llvm.org/D34446 llvm-svn: 307372
* MathExtras UnitTest: Assert that isPowerOf2(0) is false. NFC.Zvi Rackover2017-07-031-0/+2
| | | | | | | | | | | | | | | | | Summary: This is a follow-up on D34077. Elena observed that the correctness of the code relies on isPowerOf2(0) returning false. Adding a test to cover this corner-case. Reviewers: delena, davide, craig.topper Reviewed By: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34939 llvm-svn: 307046
* Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTORRichard Smith2017-06-301-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | This is a short-term fix for PR33650 aimed to get the modules build bots green again. Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR macros to try to locally specialize a global template for a global type. That's not how C++ works. Instead, we now centrally define how to format vectors of fundamental types and of string (std::string and StringRef). We use flow formatting for the former cases, since that's the obvious right thing to do; in the latter case, it's less clear what the right choice is, but flow formatting is really bad for some cases (due to very long strings), so we pick block formatting. (Many of the cases that were using flow formatting for strings are improved by this change.) Other than the flow -> block formatting change for some vectors of strings, this should result in no functionality change. Differential Revision: https://reviews.llvm.org/D34907 Corresponding updates to clang, clang-tools-extra, and lld to follow. llvm-svn: 306878
* Recommit "[Support] Add RetryAfterSignal helper function"Pavel Labath2017-06-292-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | The difference from the previous version is the use of decltype, as the implementation of std::result_of in libc++ did not work correctly for variadic function like open(2). Original summary: This function retries an operation if it was interrupted by a signal (failed with EINTR). It's inspired by the TEMP_FAILURE_RETRY macro in glibc, but I've turned that into a template function. I've also added a fail-value argument, to enable the function to be used with e.g. fopen(3), which is documented to fail for any reason that open(2) can fail (which includes EINTR). The main user of this function will be lldb, but there were also a couple of uses within llvm that I could simplify using this function. Reviewers: zturner, silvas, joerg Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33895 llvm-svn: 306671
* Make the size specification for cache_size_bytes case insensitive.Peter Collingbourne2017-06-231-1/+1
| | | | llvm-svn: 306129
* Add a ThinLTO cache policy for controlling the maximum cache size in bytes.Peter Collingbourne2017-06-231-4/+30
| | | | | | | | | | | | | | This is useful when an upper limit on the cache size needs to be controlled independently of the amount of the amount of free space. One use case is a machine with a large number of cache directories (e.g. a buildbot slave hosting a large number of independent build jobs). By imposing an upper size limit on each cache directory, users can more easily estimate the server's capacity. Differential Revision: https://reviews.llvm.org/D34547 llvm-svn: 306126
* Revert "[Support] Add RetryAfterSignal helper function" and subsequent fixPavel Labath2017-06-222-39/+0
| | | | | | | | | | | The fix in r306003 uncovered a pretty fundamental problem that libc++ implementation of std::result_of does not handle the prototype of open(2) correctly (presumably because it contains ...). This makes the whole function unusable in its current form, so I am also reverting the original commit (r305892), which introduced the function, at least until I figure out a way to solve the libc++ issue. llvm-svn: 306005
* [Support] Fix return type deduction in RetryAfterSignalPavel Labath2017-06-221-0/+5
| | | | | | | | | | | | | | | | | | The default value of the ResultT template argument (which was there only to avoid spelling out the long std::result_of template multiple times) was being overriden by function call template argument deduction. This manifested itself as a compiler error when calling the function as FILE *X = RetryAfterSignal(nullptr, fopen, ...) because the function would try to assign the result of fopen to nullptr_t, but a more insidious side effect was that RetryAfterSignal(-1, read, ...) would return "int" instead of "ssize_t", losing precision along the way. I fix this by having the function take the argument in a way that prevents argument deduction from kicking in and add a test that makes sure the return type is correct. llvm-svn: 306003
* [Support] Add RetryAfterSignal helper functionPavel Labath2017-06-212-0/+34
| | | | | | | | | | | | | | | | | | | | | Summary: This function retries an operation if it was interrupted by a signal (failed with EINTR). It's inspired by the TEMP_FAILURE_RETRY macro in glibc, but I've turned that into a template function. I've also added a fail-value argument, to enable the function to be used with e.g. fopen(3), which is documented to fail for any reason that open(2) can fail (which includes EINTR). The main user of this function will be lldb, but there were also a couple of uses within llvm that I could simplify using this function. Reviewers: zturner, silvas, joerg Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33895 llvm-svn: 305892
* Add a cantFail overload for Expected-reference (Expected<T&>) types.Lang Hames2017-06-201-0/+4
| | | | llvm-svn: 305863
* Support: chunk writing on LinuxSaleem Abdulrasool2017-06-201-0/+6
| | | | | | | | This is a workaround for large file writes. It has been witnessed that write(2) failing with EINVAL (22) due to a large value (>2G). Thanks to James Knight for the help with coming up with a sane test case. llvm-svn: 305846
* Added braces to work around gcc warning in googletest: suggest explicit ↵Galina Kistanova2017-06-151-3/+6
| | | | | | braces to avoid ambiguous 'else'. NFC. llvm-svn: 305506
* [formatv] Add the ability to specify a fill character when aligning.Zachary Turner2017-06-151-0/+2
| | | | | | | | | Previously if you used fmt_align(7, Center) you would get the output ' 7 '. It may be desirable for the user to specify the fill character though, for example producing '---7---'. This patch adds that. llvm-svn: 305449
* Don't include TestingSupport in LLVM_LINK_COMPONENTS.Zachary Turner2017-06-141-2/+1
| | | | | | | | Instead use target_link_libraries directly. Thanks to Juergen Ributzka for the suggestion, which fixes an issue when llvm is configured with no targets. llvm-svn: 305421
* [gtest] Create a shared include directory for gtest utilities.Zachary Turner2017-06-142-88/+76
| | | | | | | | | | | | | | | | | | | | | | | Many times unit tests for different libraries would like to use the same helper functions for checking common types of errors. This patch adds a common library with helpers for testing things in Support, and introduces helpers in here for integrating the llvm::Error and llvm::Expected<T> classes with gtest and gmock. Normally, we would just be able to write: EXPECT_THAT(someFunction(), succeeded()); but due to some quirks in llvm::Error's move semantics, gmock doesn't make this easy, so two macros EXPECT_THAT_ERROR() and EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties. Consider this an exception, and possibly only temporary as we look for ways to improve this. Differential Revision: https://reviews.llvm.org/D33059 llvm-svn: 305395
* Revert r305313 & r305303, self-hosting build-bot isn’t liking it.Frederich Munch2017-06-133-39/+3
| | | | llvm-svn: 305318
* Fix self hosting build-bot failure from r305303 by adjusting ↵Frederich Munch2017-06-131-0/+1
| | | | | | DynamicLibraryTests compile flags. llvm-svn: 305313
* Force RegisterStandardPasses to construct std::function in the IPO library.Frederich Munch2017-06-133-3/+38
| | | | | | | | | | | | | | Summary: Fixes an issue using RegisterStandardPasses from a statically linked object before PassManagerBuilder::addGlobalExtension is called from a dynamic library. Reviewers: efriedma, theraven Reviewed By: efriedma Subscribers: mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33515 llvm-svn: 305303
* Export the required symbol from DynamicLibraryTestsRoger Ferrer Ibanez2017-06-125-4/+23
| | | | | | | | | | | | | | | | | Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails when LLVM is configured with -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because the test's version script only contains symbols extracted from the static libraries, that the test links with, but not those from the main object/executable itself. The patch moves the one symbol, needed by the test, to a static library. Fixes https://bugs.llvm.org/show_bug.cgi?id=32893 Patch by Momchil Velikov. Differential Revision: https://reviews.llvm.org/D33789 llvm-svn: 305181
* Allow VarStreamArray to use stateful extractors.Zachary Turner2017-06-091-5/+4
| | | | | | | | | | | Previously extractors tried to be stateless with any additional context information needed in order to parse items being passed in via the extraction method. This led to quite cumbersome implementation challenges and awkwardness of use. This patch brings back support for stateful extractors, making the implementation and usage simpler. llvm-svn: 305093
* Disable all warning for AlignOfTest.cpp.Galina Kistanova2017-06-071-0/+5
| | | | llvm-svn: 304871
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-073-222/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-0626-29/+28
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* Close DynamicLibraries in reverse order they were opened.Frederich Munch2017-06-054-35/+88
| | | | | | | | | | | | | | Summary: Matches C++ destruction ordering better and fixes possible problems of loaded libraries having inter-dependencies. Reviewers: efriedma, v.g.vassilev, chapuni Reviewed By: efriedma Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33652 llvm-svn: 304720
* Fixed warning: must specify at least one argument for '...' parameter.Galina Kistanova2017-06-041-1/+1
| | | | llvm-svn: 304677
* Make mcpu=generic the default for armv7-a and armv8-a.Kristof Beyls2017-06-011-2/+2
| | | | | | | As discussed in http://lists.llvm.org/pipermail/llvm-dev/2017-May/113525.html llvm-svn: 304390
* [ManagedStatic] Avoid putting function pointers in template args.Benjamin Kramer2017-05-291-6/+11
| | | | | | | | This is super awkward, but GCC doesn't let us have template visible when an argument is an inline function and -fvisibility-inlines-hidden is used. llvm-svn: 304175
* Don't destroy ManagedStatics in a unit test.Benjamin Kramer2017-05-291-6/+0
| | | | | | | Turns out this is very hostile towards other unit tests running in the same process, it unregisters all flags. llvm-svn: 304165
* Try to work around MSVC being buggy. Attempt #1.Benjamin Kramer2017-05-291-1/+1
| | | | | | error C2971: 'llvm::ManagedStatic': template parameter 'Creator': 'CreateDefaultTimerGroup': a variable with non-static storage duration cannot be used as a non-type argument llvm-svn: 304157
* [ManagedStatic] Add a way to pass custom creators/deleters.Benjamin Kramer2017-05-291-0/+42
| | | | | | Also add a test case verifying that nested ManagedStatics work correctly. llvm-svn: 304155
* Reverted r304083 as it seems there is a desire to address this in the ↵Galina Kistanova2017-05-281-6/+3
| | | | | | googletest. llvm-svn: 304084
* Added braces to address gcc warning: suggest explicit braces to avoid ↵Galina Kistanova2017-05-281-3/+6
| | | | | | ambiguous 'else' [-Wdangling-else]. NFC. llvm-svn: 304083
* allow_user_segv_handler was already removedVitaly Buka2017-05-261-4/+0
| | | | | | New default behavior matches previous allow_user_segv_handler=1 llvm-svn: 304032
* Revert "Export the required symbol from DynamicLibraryTests"Roger Ferrer Ibanez2017-05-262-2/+0
| | | | | | This breaks sanitizer-x86_64-linux-fast buildbot. llvm-svn: 304005
* Export the required symbol from DynamicLibraryTestsRoger Ferrer Ibanez2017-05-262-0/+2
| | | | | | | | | | | | | | | | Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails when LLVM is configured with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because the test's version script only contains symbols extracted from the static libraries, that the test links with, but not those from the main object/executable itself. The patch explicitly exports the one symbol needed by the test. This change fixes https://bugs.llvm.org/show_bug.cgi?id=32893 Patch authored by Momchil Velikov. Differential Revision: https://reviews.llvm.org/D33490 llvm-svn: 303979
* Revert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery ↵Vitaly Buka2017-05-241-0/+4
| | | | | | | | | | tests"" This dependents on r303729 which was reverted. This reverts commit r303783. llvm-svn: 303796
OpenPOWER on IntegriCloud