summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Prevent UBSan report in CrashRecovery testsVitaly Buka2017-05-241-1/+1
| | | | | | Reverted by mistake with r303783. llvm-svn: 303785
* Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"Vitaly Buka2017-05-241-5/+1
| | | | | | | | It's not needed after r303729. This reverts commit r303311. llvm-svn: 303783
* Cosmetic. Added braces to address gcc warning: suggest explicit braces to ↵Galina Kistanova2017-05-201-2/+4
| | | | | | avoid ambiguous 'else' [-Wdangling-else]. llvm-svn: 303471
* Attempt to pacify ASan and UBSan reports in CrashRecovery testsReid Kleckner2017-05-171-1/+5
| | | | llvm-svn: 303311
* Add some helpers for manipulating BinaryStreamRefs.Zachary Turner2017-05-171-0/+33
| | | | llvm-svn: 303297
* Reapply part of rL303015, fixing just the DynamicLibaryTest. AddDimitry Andric2017-05-171-1/+3
| | | | | | | retrieval of the original argv[0] from the GoogleTest framework, so it is more likely the correct main executable path is found. llvm-svn: 303289
* Revert r303015, because it has the unintended side effect of breakingDimitry Andric2017-05-171-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | driver-mode recognition in clang (this is because the sysctl method always returns one and only one executable path, even for an executable with multiple links): Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD Summary: After rL301562, on FreeBSD the DynamicLibrary unittests fail, because the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since the path does not contain any slashes, retrieving the main executable will not work. Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3), which is more reliable than fiddling with relative or absolute paths. Also add retrieval of the original argv[] from the GoogleTest framework, to use as a fallback for other OSes. Reviewers: emaste, marsupial, hans, krytarowski Reviewed By: krytarowski Subscribers: krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D33171 llvm-svn: 303285
* Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"Reid Kleckner2017-05-172-0/+84
| | | | | | | | | | | We have to check gCrashRecoveryEnabled before using __try. In other words, SEH works too well and we ended up recovering from crashes in implicit module builds that we weren't supposed to. Only libclang is supposed to enable CrashRecoveryContext to allow implicit module builds to crash. llvm-svn: 303279
* Revert "[CrashRecovery] Use SEH __try instead of VEH when available"Reid Kleckner2017-05-172-84/+0
| | | | | | This reverts commit r303274, it appears to break some clang tests. llvm-svn: 303275
* [CrashRecovery] Use SEH __try instead of VEH when availableReid Kleckner2017-05-172-0/+84
| | | | | | | | | | | | | | | | | | | | Summary: It avoids problems when other libraries raise exceptions. In particular, OutputDebugString raises an exception that the debugger is supposed to catch and suppress. VEH kicks in first right now, and that is entirely incorrect. Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH codepath around. We could fix it with SetUnhandledExceptionFilter, but that is not per-thread, so a well-behaved library shouldn't set it. Reviewers: zturner Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D33261 llvm-svn: 303274
* Add test for FixedStreamArrayIterator::operator->Adrian McCarthy2017-05-161-2/+27
| | | | | | | | | | | The operator-> implementation comes from iterator_facade_base, so it should just work given that the iterator has a tested operator*. But r302257 showed that required careful handling of for the const qualifier. This patch ensures the fix in r302257 doesn't regress. Differential Revision: https://reviews.llvm.org/D33249 llvm-svn: 303215
* Fix DynamicLibraryTest.cpp on FreeBSD and NetBSDDimitry Andric2017-05-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: After rL301562, on FreeBSD the DynamicLibrary unittests fail, because the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since the path does not contain any slashes, retrieving the main executable will not work. Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3), which is more reliable than fiddling with relative or absolute paths. Also add retrieval of the original argv[] from the GoogleTest framework, to use as a fallback for other OSes. Reviewers: emaste, marsupial, hans, krytarowski Reviewed By: krytarowski Subscribers: krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D33171 llvm-svn: 303015
* Make sure we have actually written what is expected by the test.Galina Kistanova2017-05-121-1/+1
| | | | llvm-svn: 302922
* SupportTests: Suppress ParallelTests on mingw for now. Investigating.NAKAMURA Takumi2017-05-111-0/+5
| | | | llvm-svn: 302766
* [Support] Move Parallel algorithms from LLD to LLVM.Zachary Turner2017-05-112-0/+49
| | | | | | Differential Revision: https://reviews.llvm.org/D33024 llvm-svn: 302748
* [AArch64] Make the TargetParser add CPU exts provided by the arch.Ahmed Bougacha2017-05-031-13/+23
| | | | | | | | | | | | | | | | Otherwise, each CPU has to manually specify the extensions it supports, even though they have to be a superset of the base arch extensions. And when there's redundant data there's stale data, so most of the CPUs lie about the features they support (almost none lists AEK_FP). Instead, do the saner thing: add the optional extensions on top of the base extensions provided by the architecture. The ARM TargetParser has the same behavior. Differential Revision: https://reviews.llvm.org/D32780 llvm-svn: 302078
* Fix use after free in BinaryStream library.Zachary Turner2017-05-031-7/+7
| | | | | | | | | | | | | | | This was reported by the ASAN bot, and it turned out to be a fairly fundamental problem with the design of VarStreamArray and the way it passes context information to the extractor. The fix was cumbersome, and I'm not entirely pleased with it, so I plan to revisit this design in the future when I'm not pressed to get the bots green again. For now, this fixes the issue by storing the context information by value instead of by reference, and introduces some impossibly-confusing template magic to make things "work". llvm-svn: 301999
* Fix a few pedantic warnings.Frederich Munch2017-04-271-2/+2
| | | | | | | | | | | | Reviewers: zturner, hansw, hans Reviewed By: hans Subscribers: hans, llvm-commits Differential Revision: https://reviews.llvm.org/D32611 llvm-svn: 301595
* Limit disabling of warnings emitted from r301571 by checking __GNUC__.Frederich Munch2017-04-271-1/+1
| | | | llvm-svn: 301572
* Fix warnings from test added in r301562 on Windows (when built without ↵Frederich Munch2017-04-271-0/+10
| | | | | | exceptions). llvm-svn: 301571
* Refactor DynamicLibrary so searching for a symbol will have a defined order andFrederich Munch2017-04-275-0/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | libraries are properly unloaded when llvm_shutdown is called. Summary: This was mostly affecting usage of the JIT, where storing the library handles in a set made iteration unordered/undefined. This lead to disagreement between the JIT and native code as to what the address and implementation of particularly on Windows with stdlib functions: JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv Native: getenv("TEST") -> NULL // called ucrt.dll, getenv Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows not giving priority to the process' symbols as it did on Unix. Reviewers: chapuni, v.g.vassilev, lhames Reviewed By: lhames Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D30107 llvm-svn: 301562
* [Support] Make BinaryStreamArray extractors stateless.Zachary Turner2017-04-271-9/+9
| | | | | | | Instead, we now pass a context memeber through the extraction process. llvm-svn: 301556
* Revert "Refactor DynamicLibrary so searching for a symbol will have a ↵Frederich Munch2017-04-245-209/+0
| | | | | | | | | | defined order" The i686-mingw32-RA-on-linux bot is still having errors. This reverts commit r301236. llvm-svn: 301240
OpenPOWER on IntegriCloud