summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix some sign compare warnings breaking the -Werror buildDavid Blaikie2016-07-281-2/+2
| | | | llvm-svn: 277040
* Removed unused variablesSimon Pilgrim2016-07-281-12/+0
| | | | llvm-svn: 276975
* Fix signed/unsigned warning.Simon Pilgrim2016-07-281-6/+6
| | | | llvm-svn: 276974
* Remove two tests added in r276957.Daniel Jasper2016-07-281-18/+0
| | | | | | | | These loop from 0 to AEK_XSCALE, which is currently defined as 0x80000000, and thus the tests loop over the entire int range, which is unreasonable and also too slow in debug builds. llvm-svn: 276969
* R276957 broke bot clang-ppc64be-linux-multistage,try to fix it.Zijiao Ma2016-07-281-4/+4
| | | | llvm-svn: 276966
* Add unittests to {ARM | AArch64}TargetParser.Zijiao Ma2016-07-281-17/+502
| | | | | | | | | | | | | | Add unittest to {ARM | AArch64}TargetParser,and by the way correct problems as below: 1.Correct a incorrect indexing problem in AArch64TargetParser. The architecture enumeration is shared across ARM and AArch64 in original implementation.But In the code,I just used the index which was offset by the ARM, and this would index into the array incorrectly. To make AArch64 has its own arch enum,or we will do a lot of slowly iterating. 2.Correct a spelling error. The parameter of llvm::AArch64::getArchExtName. 3.Correct a writing mistake, in llvm::ARM::parseArchISA. Differential Revision: https://reviews.llvm.org/D21785 llvm-svn: 276957
* [Support] Make ErrorAsOutParameter take an Error* rather than an Error&.Lang Hames2016-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | This allows ErrorAsOutParameter to work better with "optional" errors. For example, consider a function where for certain input values it is known that the function can't fail. This can now be written as: Result foo(Arg X, Error *Err) { ErrorAsOutParameter EAO(Err); if (<Error Condition>) { if (Err) *Err = <report error>; else llvm_unreachable("Unexpected failure!"); } } Rather than having to construct an ErrorAsOutParameter under every conditional where Err is known to be non-null. llvm-svn: 276430
* Add tests for max/minIntN(64).Justin Lebar2016-07-171-0/+4
| | | | | | | | | | | | | | Summary: Given that we had a bug on max/minUIntN(64), these should have tests too. Reviewers: rnk Subscribers: dylanmckay, llvm-commits Differential Revision: https://reviews.llvm.org/D22443 llvm-svn: 275723
* Fix isShiftedInt and isShiftedUint for widths > 32.Justin Lebar2016-07-171-0/+38
| | | | | | | | | | | | | | | | | Summary: Previously we were doing 1 << S. "1" is an int, so this doesn't work when S >= 32. This patch also adds some static_asserts to these functions to ensure that we don't hit UB by shifting left too much. Reviewers: rnk Subscribers: llvm-commits, dylanmckay Differential Revision: https://reviews.llvm.org/D22441 llvm-svn: 275719
* Don't do uint64_t(1) << 64 in maxUIntN.Justin Lebar2016-07-161-0/+1
| | | | | | | | | | | | | | Summary: This shift is undefined behavior (and, as compiled by clang, gives the wrong answer for maxUIntN(64)). Reviewers: mkuper Subscribers: llvm-commits, jroelofs, rsmith Differential Revision: https://reviews.llvm.org/D22430 llvm-svn: 275656
* [Support] Fix a bug in ErrorList::join / joinErrors.Lang Hames2016-06-301-0/+45
| | | | | | | | When concatenating two error lists the ErrorList::join method (which is called by joinErrors) was failing to set the checked bit on the second error, leading to a 'failure to check error' assertion. llvm-svn: 274249
* Resubmit "Update llvm command line parser to support subcommands."Zachary Turner2016-06-292-5/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where occurrence counts would be unexpectedly reset when parsing different parts of a command line multiple times. **ORIGINAL COMMIT MESSAGE** This allows command line tools to use syntaxes like the following: llvm-foo.exe command1 -o1 -o2 llvm-foo.exe command2 -p1 -p2 Where command1 and command2 contain completely different sets of valid options. This is backwards compatible with previous uses of llvm cl which did not support subcommands, as any option which specifies no optional subcommand (e.g. all existing code) goes into a special "top level" subcommand that expects dashed options to appear immediately after the program name. For example, code which is subcommand unaware would generate a command line such as the following, where no subcommand is specified: llvm-foo.exe -q1 -q2 The top level subcommand can co-exist with actual subcommands, as it is implemented as an actual subcommand which is searched if no explicit subcommand is specified. So llvm-foo.exe as specified above could be written so as to support all three aforementioned command lines simultaneously. There is one additional "special" subcommand called AllSubCommands, which can be used to inject an option into every subcommand. This is useful to support things like help, so that commands such as: llvm-foo.exe --help llvm-foo.exe command1 --help llvm-foo.exe command2 --help All work and display the help for the selected subcommand without having to explicitly go and write code to handle each one separately. This patch is submitted without an example of anything actually using subcommands, but a followup patch will convert the llvm-pdbdump tool to use subcommands. Reviewed By: beanz llvm-svn: 274171
* Revert r274054 to try to appease the botManman Ren2016-06-282-203/+5
| | | | llvm-svn: 274072
* Update llvm command line parser to support subcommands.Zachary Turner2016-06-282-5/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows command line tools to use syntaxes like the following: llvm-foo.exe command1 -o1 -o2 llvm-foo.exe command2 -p1 -p2 Where command1 and command2 contain completely different sets of valid options. This is backwards compatible with previous uses of llvm cl which did not support subcommands, as any option which specifies no optional subcommand (e.g. all existing code) goes into a special "top level" subcommand that expects dashed options to appear immediately after the program name. For example, code which is subcommand unaware would generate a command line such as the following, where no subcommand is specified: llvm-foo.exe -q1 -q2 The top level subcommand can co-exist with actual subcommands, as it is implemented as an actual subcommand which is searched if no explicit subcommand is specified. So llvm-foo.exe as specified above could be written so as to support all three aforementioned command lines simultaneously. There is one additional "special" subcommand called AllSubCommands, which can be used to inject an option into every subcommand. This is useful to support things like help, so that commands such as: llvm-foo.exe --help llvm-foo.exe command1 --help llvm-foo.exe command2 --help All work and display the help for the selected subcommand without having to explicitly go and write code to handle each one separately. This patch is submitted without an example of anything actually using subcommands, but a followup patch will convert the llvm-pdbdump tool to use subcommands. Reviewed By: beanz Differential Revision: http://reviews.llvm.org/D21485 llvm-svn: 274054
* Switch to using an API that handles non-ASCII paths appropriately on Windows.Aaron Ballman2016-06-211-0/+26
| | | | llvm-svn: 273262
* Fix a relatively nasty bug with fs::getPathFromOpenFD() on Windows. The ↵Aaron Ballman2016-06-201-0/+33
| | | | | | GetFinalPathNameByHandle API does not behave as documented; if given a buffer that has enough space for the path but not the null terminator, the call will return the number of characters required *without* the null terminator (despite being documented otherwise) and it will not set GetLastError(). The result was that this function would return a bogus path and no error. Instead, ensure there is sufficient space for a null terminator (we already strip it off manually for compatibility with older versions of Windows). llvm-svn: 273195
* In openFileForRead, attempt to fetch the actual name of the file on disk -- ↵Taewook Oh2016-06-131-0/+57
| | | | | | | | | | | | | including case -- so that clang can later warn about non-portable #include and #import directives. Differential Revision: http://reviews.llvm.org/D19842 Corresponding clang patch: http://reviews.llvm.org/D19843 Re-commit after addressing issues with of generating too many warnings for Windows and asan test failures Patch by Eric Niebler llvm-svn: 272555
* Support: correct AArch64 TargetParser implementationSaleem Abdulrasool2016-06-081-0/+41
| | | | | | | | | | | | | | | | | | | | | | | The architecture enumeration is shared across ARM and AArch64. However, the data is not. The code incorrectly would index into the array using the architecture index which was offset by the ARMv7 architecture enumeration. We do not have a marker for indicating the architectural family to which the enumeration belongs so we cannot be clever about offsetting the index (at least it is not immediately apparent to me). Instead, fall back to the tried-and-true method of slowly iterating the array (its not a large array, so the impact of this is not too high). Because of the incorrect indexing, if we were lucky, we would crash, but usually we would return an invalid StringRef. We did not have any tests for the AArch64 target parser previously;. Extend the previous tests I had added for ARM to cover AArch64 for ensuring that we return expected StringRefs. Take the opportunity to change some iterator types to references. This work is needed to support parsing `.arch name` directives in the AArch64 target asm parser. llvm-svn: 272145
* [yaml] Add a ScalarTraits for mapping endian aware types.Zachary Turner2016-06-071-0/+106
| | | | | | | | | | This allows mapping of any endian-aware type whose underlying type (e.g. uint32_t) provides a ScalarTraits specialization. Reviewed by: majnemer Differential Revision: http://reviews.llvm.org/D21057 llvm-svn: 272049
* Fix deadlock in ThreadPool unittest.Eli Friedman2016-06-051-1/+1
| | | | | | | (Yes, this only deadlocks on a computer with a single core; I'm using a virtual machine.) llvm-svn: 271855
* Revert commit r271704, a patch that enables warnings for non-portable ↵Taewook Oh2016-06-041-57/+0
| | | | | | #include and #import paths (Corresponding clang patch has been reverted by r271761). Patches are reverted because they generate lots of unadressable warnings for windows and fail tests under ASAN. llvm-svn: 271764
* In openFileForRead, attempt to fetch the actual name of the file on disk -- ↵Taewook Oh2016-06-031-0/+57
| | | | | | | | | | including case -- so that clang can later warn about non-portable #include and #import directives. Differential Revision: http://reviews.llvm.org/D19842 Patch by Eric Niebler llvm-svn: 271704
* Add tests to Support/MathExtrasDylan McKay2016-06-021-0/+29
| | | | | | | | | In r271380, I added several functions to get the minimum/maximum values of n-width integers. This just adds tests for them. llvm-svn: 271505
* [Support] Rename unconvertibleErrorCode to inconvertibleErrorCode.Lang Hames2016-05-271-1/+1
| | | | | | | Based on a totally scientific, 30 second google search "in-" appears to be the preferred prefix. llvm-svn: 270950
* [Support] Add a StringError convenience class to Error.hLang Hames2016-05-271-0/+16
| | | | | | | | StringError can be used to represent Errors that aren't recoverable based on the error type, but that have a useful error message that can be reported to the user or logged. llvm-svn: 270948
* [ThinLTO] Option to control path of distributed backend filesTeresa Johnson2016-05-171-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support to control where files for a distributed backend (the individual index files and optional imports files) are created. This is invoked with a new thinlto-prefix-replace option in the gold plugin and llvm-lto. If specified, expects a string of the form "oldprefix:newprefix", and instead of generating these files in the same directory path as the corresponding bitcode file, will use a path formed by replacing the bitcode file's path prefix matching oldprefix with newprefix. Also add a new replace_path_prefix helper to Path.h in libSupport. Depends on D19636. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19644 llvm-svn: 269771
* [Support][Unittests] Add unittest for recursive_directory_iterator::level()Bruno Cardoso Lopes2016-05-131-0/+14
| | | | llvm-svn: 269488
* [Support] Add a free toString function for ErrorVedant Kumar2016-05-031-0/+19
| | | | | | | | | | toString() consumes an Error and returns a string representation of its contents. This commit also adds a message() method to ErrorInfoBase for convenience. Differential Revision: http://reviews.llvm.org/D19883 llvm-svn: 268465
* Use gcc's rules for parsing gcc-style response filesNico Weber2016-04-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | In gcc, \ escapes every character in response files. It is true that this makes it harder to mention Windows files in rsp files, but not doing this means clang disagrees with gcc, and also disagrees with the shell (on non-Windows) which rsp file quoting is supposed to match. clang isn't free to choose what to do here. In general, the idea for response files is to take bits of your command line and write them to a file unchanged, and have things work the same way. Since the command line would've been interpreted by the shell, things in the rsp file need to be subject to the same shell quoting rules. People who want to put Windows-style paths in their response files either need to do any of: * escape their backslashes * or use clang-cl which uses cl.exe/cmd.exe quoting rules * pass --rsp-quoting=windows to clang to tell it to use cl.exe/cmd.exe quoting rules for response files. Fixes PR27464. http://reviews.llvm.org/D19417 llvm-svn: 267556
* [Support] Fix latent bugs in Expected and ExitOnError that were preventing themLang Hames2016-04-251-0/+14
| | | | | | from working with reference types. llvm-svn: 267448
* Unbreak building unit tests on Windows after r266595.Nico Weber2016-04-181-0/+1
| | | | llvm-svn: 266614
* [NFC] Header cleanupMehdi Amini2016-04-184-3/+1
| | | | | | | | | | | | | | Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
* Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining ↵Duncan P. N. Exon Smith2016-04-055-29/+15
| | | | | | | | | | files; other minor fixes." This reverts commit r265454 since it broke the build. E.g.: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/ llvm-svn: 265459
* Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; ↵Eugene Zelenko2016-04-055-15/+29
| | | | | | | | | | | | other minor fixes. Some Include What You Use suggestions were used too. Use anonymous namespaces in source files. Differential revision: http://reviews.llvm.org/D18778 llvm-svn: 265454
* [Support] Add a checked flag to Expected<T>, require checks before access orLang Hames2016-04-051-4/+46
| | | | | | | | | | destruction. This makes the Expected<T> class behave like Error, even when in success mode. Expected<T> values must be checked to see whether they contain an error prior to being dereferenced, assigned to, or destructed. llvm-svn: 265446
* [Support] Fix an invalid character escaping in string literal (unittest).Etienne Bergeron2016-04-051-1/+1
| | | | | | | | | | | | | | | | | | Summary: A character within a string literal is not escaped correctly. In this case, there is no semantic change because the invalid character turn out to be NUL anyway. note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }. This issue was found by clang-tidy. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18747 llvm-svn: 265376
* Add support for computing SHA1 in LLVMMehdi Amini2016-04-012-0/+73
| | | | | | | | | | | | | | | | 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-012-73/+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-012-0/+73
| | | | | | | | | | | 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: Implement StreamingMemoryObject::getPointerDuncan P. N. Exon Smith2016-03-271-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation is fairly obvious. This is preparation for using some blobs in bitcode. For clarity (and perhaps future-proofing?), I moved the call to JumpToBit in BitstreamCursor::readRecord ahead of calling MemoryObject::getPointer, since JumpToBit can theoretically (a) read bytes, which (b) invalidates the blob pointer. This isn't strictly necessary the two memory objects we have: - The return of RawMemoryObject::getPointer is valid until the memory object is destroyed. - StreamingMemoryObject::getPointer is valid until the next chunk is read from the stream. Since the JumpToBit call is only going ahead to a word boundary, we'll never load another chunk. However, reordering makes it clear by inspection that the blob returned by BitstreamCursor::readRecord will be valid. I added some tests for StreamingMemoryObject::getPointer and BitstreamCursor::readRecord. llvm-svn: 264549
* Support: Move StreamingMemoryObject{,Test}.cpp, NFCDuncan P. N. Exon Smith2016-03-272-10/+13
| | | | | | | | 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] Switch to RAII helper for error-as-out-parameter idiom.Lang Hames2016-03-251-4/+24
| | | | | | As discussed on the llvm-commits thread for r264467. llvm-svn: 264479
* [Support] Add Error::errorForOutParameter helper.Lang Hames2016-03-251-0/+6
| | | | | | | | This helper method creates a pre-checked Error suitable for use as an out parameter in a constructor. This avoids the need to have the constructor check a known-good error before assigning to it. llvm-svn: 264467
* Try to fix ODR violation of ErrorInfo::IDReid Kleckner2016-03-241-3/+10
| | | | | | This implements my suggestion to Lang. llvm-svn: 264360
* ErrorTest.cpp: Move instantiations out of anonymous namespace. gcc didn't ↵NAKAMURA Takumi2016-03-241-4/+3
| | | | | | complain. llvm-svn: 264297
* Define ErrorInfo::ID explicitly.NAKAMURA Takumi2016-03-241-0/+4
| | | | llvm-svn: 264293
* ErrorTest.cpp: Fix an expression, possibly typo.NAKAMURA Takumi2016-03-241-1/+1
| | | | llvm-svn: 264290
* [Support] Add conversions between Expected<T> and ErrorOr<T>.Lang Hames2016-03-241-1/+24
| | | | | | More utilities to help with std::error_code -> Error transitions. llvm-svn: 264238
* [Support] Make all Errors convertible to std::error_code.Lang Hames2016-03-231-0/+9
| | | | | | | | | | | | This is a temporary crutch to enable code that currently uses std::error_code to be incrementally moved over to Error. Requiring all Error instances be convertible enables clients to call errorToErrorCode on any error (not just ECErrors created by conversion *from* an error_code). This patch also moves code for Error from ErrorHandling.cpp into a new Error.cpp file. llvm-svn: 264221
* [Support] Refactor Error unit tests to avoid duplicating work.Lang Hames2016-03-181-294/+229
| | | | | | Suggested by Dave Blaikie in review for r263749. Thanks Dave! llvm-svn: 263768
OpenPOWER on IntegriCloud