summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* Add an c++ itanium demangler to llvm.Rafael Espindola2016-09-062-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a copy of the demangler in libcxxabi. The code also has no dependencies on anything else in LLVM. To enforce that I added it as another library. That way a BUILD_SHARED_LIBS will fail if anyone adds an use of StringRef for example. The no llvm dependency combined with the fact that this has to build on linux, OS X and Windows required a few changes to the code. In particular: No constexpr. No alignas On OS X at least this library has only one global symbol: __ZN4llvm16itanium_demangleEPKcPcPmPi My current plan is: Commit something like this Change lld to use it Change lldb to use it as the fallback Add a few #ifdefs so that exactly the same file can be used in libcxxabi to export abi::__cxa_demangle. Once the fast demangler in lldb can handle any names this implementation can be replaced with it and we will have the one true demangler. llvm-svn: 280732
* [Support] - Fix possible crash in match() of llvm::Regex.George Rimar2016-09-021-0/+10
| | | | | | | | | | | | Crash was possible if match() method was called on object that was moved or object created with empty constructor. Testcases updated. DIfferential revision: https://reviews.llvm.org/D24123 llvm-svn: 280473
* Fix a real temp file leak in FileOutputBufferReid Kleckner2016-09-021-0/+3
| | | | | | | | | | | | | If we failed to commit the buffer but did not die to a signal, the temp file would remain on disk on Windows. Having an open file mapping and file handle prevents the file from being deleted. I am choosing not to add an assertion of success on the temp file removal, since virus scanners and other environmental things can often cause removal to fail in real world tools. Also fix more temp file leaks in unit tests. llvm-svn: 280445
* [Support] Fix a warning introduced in r280339 due to the memberChandler Carruth2016-09-011-1/+1
| | | | | | | | | | | | initializers not being in the same order as the members. Specifically, 'preg' is the first member followed by 'error', so they will be initialized in that order and should be written in the member initializer list in that order. For the constructor in question, there is no change in behavior. llvm-svn: 280345
* [LLVM/Support] - Create no-arguments constructor for llvm::RegexGeorge Rimar2016-09-011-0/+2
| | | | | | | | | This is useful when need to defer the construction, e.g. using Regex as a member of class. Differential revision: https://reviews.llvm.org/D24101 llvm-svn: 280339
* ADT: Split ilist_node_traits into alloc and callback, NFCDuncan P. N. Exon Smith2016-08-301-9/+2
| | | | | | | | | | | | | | | | Many lists want to override only allocation semantics, or callbacks for iplist. Split these up to prevent code duplication. - Specialize ilist_alloc_traits to change the implementations of deleteNode() and createNode(). - One common desire is to do nothing deleteNode() and disable createNode(). Specialize ilist_alloc_traits to inherit from ilist_noalloc_traits for that behaviour. - Specialize ilist_callback_traits to use the addNodeToList(), removeNodeFromList(), and transferNodesFromList() callbacks. As a drive-by, add some coverage to the callback-related unit tests. llvm-svn: 280128
* Implement getRandomBytes() functionEugene Leviant2016-08-262-0/+38
| | | | | | | | | This function allows getting arbitrary sized block of random bytes. Primary motivation is support for --build-id=uuid in lld. Differential revision: https://reviews.llvm.org/D23671 llvm-svn: 279807
* Make some LLVM_CONSTEXPR variables const. NFC.George Burgess IV2016-08-251-1/+1
| | | | | | | | | | This patch changes LLVM_CONSTEXPR variable declarations to const variable declarations, since LLVM_CONSTEXPR expands to nothing if the current compiler doesn't support constexpr. In all of the changed cases, it looks like the code intended the variable to be const instead of sometimes-constexpr sometimes-not. llvm-svn: 279696
* Preserve a pointer to the newly allocated signal stack as well. That tooChandler Carruth2016-08-241-4/+6
| | | | | | is flagged by LSan at least among leak detectors. llvm-svn: 279605
* Increase the size of the sigaltstack used by LLVM signal handlers. 8KB is notRichard Smith2016-08-241-1/+1
| | | | | | | | sufficient in some cases; increase to 64KB, which should be enough for anyone :) Patch by github.com/bryant! llvm-svn: 279599
* Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko2016-08-235-18/+31
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
* ADT: Remove ilist_*sentinel_traits, NFCDuncan P. N. Exon Smith2016-08-221-4/+0
| | | | | | | | | | Remove all the dead code around ilist_*sentinel_traits. This is a follow-up to gutting them as part of r279314 (originally r278974), staged to prevent broken builds in sub-projects. Uses were removed from clang in r279457 and lld in r279458. llvm-svn: 279473
* Add ADT headers to the cmake headers directory for LLVMSupport. NFC.Pete Cooper2016-08-221-0/+1
| | | | | | | | | Xcode and MSVC list the headers and source files for each library. LLVMSupport lists included the source files for ADT but not the headers. This add the ADT headers so that they are browsable by the UI. llvm-svn: 279470
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-173-9/+9
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
* Support the DW_AT_noreturn DWARF flag.Adrian Prantl2016-08-171-0/+1
| | | | | | | | | | | This is used to mark functions with the C++11 [[ noreturn ]] or C11 _Noreturn attributes. Patch by Victor Leschuk! https://reviews.llvm.org/D23167 llvm-svn: 278940
* Remove excessive padding from LineNoCacheTyBenjamin Kramer2016-08-161-1/+1
| | | | | | | | | | | | The struct LineNoCacheTy is in SourceMgr.cpp inside anonymous namespace. This diff changes the order of fields and removes the excessive padding (8 bytes). Patch by Alexander Shaposhnikov! Differential revision: https://reviews.llvm.org/D23546 llvm-svn: 278838
* ADT: Share code for embedded sentinel traits, NFCDuncan P. N. Exon Smith2016-08-121-14/+3
| | | | | | | | | | | | | | | | | | | | | | | Share code for the (mostly problematic) embedded sentinel traits. - Move the LLVM_NO_SANITIZE("object-size") attribute to ilist_half_embedded_sentinel_traits and ilist_embedded_sentinel_traits (previously it spread throughout the code duplication). - Add an ilist_full_embedded_sentinel_traits which has no UB (but has the downside of storing the complete node). - Replace all the custom sentinel traits in LLVM with a declaration of ilist_sentinel_traits that inherits from one of the embedded sentinel traits classes. There are still custom sentinel traits in other LLVM subprojects. I'll remove those in a follow-up. Nothing at all should be changing here, this is just rearranging code. Note that the final goal here is to remove the sentinel traits altogether, settling on the memory layout of ilist_half_embedded_sentinel_traits without the UB. This intermediate step moves the logic into ilist.h. llvm-svn: 278513
* Use the range variant of find/find_if instead of unpacking begin/endDavid Majnemer2016-08-122-2/+2
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278469
* Use the range variant of find_if instead of unpacking begin/endDavid Majnemer2016-08-122-5/+4
| | | | | | No functionality change is intended. llvm-svn: 278443
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-112-3/+3
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* Fix UB in APInt::ashrJonathan Roelofs2016-08-101-5/+1
| | | | | | | | i64 -1, whose sign bit is the 0th one, can't be left shifted without invoking UB. https://reviews.llvm.org/D23362 llvm-svn: 278280
* Add unittests to {ARM | AArch64}TargetParser.Zijiao Ma2016-07-281-48/+51
| | | | | | | | | | | | | | 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
* [CommandLine] Use Process::GetEnv instead of _wgetenvDavid Majnemer2016-07-241-21/+4
| | | | | | | | | | Process::GetEnv does the right thing across our platforms. CommandLine.cpp had, more or less, the same logic. Let's remove the duplication. No functional change is intended. llvm-svn: 276572
* Use RValue refs in APInt add/sub methods.Pete Cooper2016-07-221-38/+16
| | | | | | | | | | | | | This adds versions of operator + and - which are optimized for the LHS/RHS of the operator being RValue's. When an RValue is available, we can use its storage space instead of allocating new space. On code such as ConstantRange which makes heavy use of APInt's over 64-bits in size, this results in significant numbers of saved allocations. Thanks to David Blaikie for all the review and most of the code here. llvm-svn: 276470
* [llvm-cov] - Improve llvm-cov error messageYing Yi2016-07-221-1/+2
| | | | | | | | | | | | | | | | | | | Summary: When giving the following command: % llvm-cov report -instr-profile=default.profraw llvm-cov will give the following error message: >llvm-cov report: Not enough positional command line arguments specified! >Must specify at least 1 positional arguments: See: orbis-llvm-cov report -help This patch changes the error message from '1 positional arguments' to '1 positional argument'. Differential Revision: https://reviews.llvm.org/D22621 llvm-svn: 276404
* Properly ifdef the use of cpuid.Alina Sbirlea2016-07-201-1/+6
| | | | llvm-svn: 276156
* [cpu-detection] Cleanup of Host.cpp.Alina Sbirlea2016-07-201-46/+48
| | | | | | | | | | | | | | Summary: Mirroring most cleanup changed from compiler-rt/lib/builtins/cpu_model. x86 methods are still returning a bool. Reviewers: llvm-commits, echristo, craig.topper, sanjoy Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D22480 llvm-svn: 276149
* Get rid of call to StringRef::substr that's never used.Justin Lebar2016-07-191-1/+0
| | | | | | | | | | | | Summary: substr doesn't modify the string, so this line has no effect. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22540 llvm-svn: 276057
* Add AIX support to Path.inc, Host.h, and CMake.Chandler Carruth2016-07-191-2/+3
| | | | | | | | Patch by Andrew Paprocki! Differential Revision: https://reviews.llvm.org/D18359 llvm-svn: 276045
* Use posix_fallocate instead of ftruncate.Rafael Espindola2016-07-191-0/+9
| | | | | | | | | | | This makes sure that space is actually available. With this change running lld on a full file system causes it to exit with failed to open foo: No space left on device instead of crashing with a sigbus. llvm-svn: 276017
* [mips] Recognise the triple used by Debian stretch for mips64el.Daniel Sanders2016-07-191-0/+2
| | | | | | | | | | | | | Summary: The triple used for this distribution is mips64el-linux-gnuabi64. Reviewers: sdardis Subscribers: sdardis, llvm-commits Differential Revision: https://reviews.llvm.org/D22406 llvm-svn: 275966
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-141-0/+11
| | | | llvm-svn: 275361
* Synchronize LLVM and clang's ObjCDeclSpec::ObjCPropertyAttributeKind.Adrian Prantl2016-07-141-0/+6
| | | | | | | | | | This adds Clang-specific DWARF constants for nullability and ObjC class properties that are already generated by clang. This patch adds dwarfdump support and a more comprehensive testcase. <rdar://problem/27335745> llvm-svn: 275354
* [Object] Revert r275316, Archive::child_iterator changes, while I update lld.Lang Hames2016-07-141-11/+0
| | | | | | Should fix the bots broken by r275316. llvm-svn: 275353
* [Object] Change Archive::child_iterator for better interop with Error/Expected.Lang Hames2016-07-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | See http://reviews.llvm.org/D22079 Changes the Archive::child_begin and Archive::children to require a reference to an Error. If iterator increment fails (because the archive header is damaged) the iterator will be set to 'end()', and the error stored in the given Error&. The Error value should be checked by the user immediately after the loop. E.g.: Error Err; for (auto &C : A->children(Err)) { // Do something with archive child C. } // Check the error immediately after the loop. if (Err) return Err; Failure to check the Error will result in an abort() when the Error goes out of scope (as guaranteed by the Error class). llvm-svn: 275316
* [Support] Make helper function static. NFC.Benjamin Kramer2016-07-101-2/+2
| | | | llvm-svn: 275017
* IR: Set a TargetPrefix for nvvm intrinsicsJustin Bogner2016-07-081-2/+3
| | | | | | | | | Since these are named nvvm_* rather than nvptx_*, we also need to update getArchTypePrefix. It's a bit unusual for getArchTypePrefix not to match the backend name, but I think this fits the intent of the function in this case. llvm-svn: 274890
* [Support][Error] Make logAllUnhandledErrors take a Twine for the banner, ratherLang Hames2016-07-041-0/+9
| | | | | | than a const string&. llvm-svn: 274526
* Add RenderScript ArchTypePirama Arumuga Nainar2016-07-021-73/+91
| | | | | | | | | | | | | | | | Summary: Add renderscript32 and renderscript64 ArchTypes. This is to configure the ABI requirement on 32-bit RenderScript that 'long' types have 64-bit size and alignment. 64-bit RenderScript is the same as AArch64, but is added here for completeness. Reviewers: echristo, rsmith Subscribers: aemerson, jfb, rampitec, dschuff, mehdi_amini, llvm-commits, srhines Differential Revision: http://reviews.llvm.org/D21333 llvm-svn: 274412
* Resubmit "Update llvm command line parser to support subcommands."Zachary Turner2016-06-291-98/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Triple] Reimplement isLittleEndian(). Now it works for arm too.Davide Italiano2016-06-291-30/+25
| | | | | | Differential Revision: http://reviews.llvm.org/D21846 llvm-svn: 274154
* [ManagedStatic] Reimplement double-checked locking with std::atomic.Benjamin Kramer2016-06-291-12/+3
| | | | | | | | | | | | | This gets rid of the memory fence in the hot path (dereferencing the ManagedStatic), trading for an extra mutex lock in the cold path (when the ManagedStatic was uninitialized). Since this only happens on the first accesses it shouldn't matter much. On strict architectures like x86 this removes any atomic instructions from the hot path. Also remove the tsan annotations, tsan knows how standard atomics work so they should be unnecessary now. llvm-svn: 274131
* [Triple] Add isLittleEndian().Davide Italiano2016-06-291-0/+4
| | | | | | | | | | This allows us to query about the endianness without having to look at DataLayout. The API will be used (and tested) in lld, in order to find out the endianness of BitcodeFiles. Briefly discussed with Rafael. llvm-svn: 274090
* Revert r274054 to try to appease the botManman Ren2016-06-281-378/+98
| | | | llvm-svn: 274072
* [YAML] Fix YAML tags appearing before the start of sequence elementsChris Bieneman2016-06-281-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Our existing yaml::Output code writes tags immediately when mapTag is called, without any state handling. This results in tags on sequence elements being written before the element itself. For example, we see this: SomeArray: !elem_type - key1: 1 key2: 2 !elem_type2 - key3: 3 key4: 4 We should instead see: SomeArray: - !elem_type key1: 1 key2: 2 - !elem_type2 key3: 3 key4: 4 Our reader handles reading properly, so this bug only impacts writing yaml sequences with tagged elements. As a test for this I've modified the Mach-O yaml encoding to allways apply the !mach-o tag when encoding MachOYAML::Object entries. This results in the !mach-o tag appearing as expected in dumped fat files. llvm-svn: 274067
* Update llvm command line parser to support subcommands.Zachary Turner2016-06-281-98/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* CachePruning: correct comment about file order. NFCPawel Bylica2016-06-271-3/+3
| | | | | | | | | | | | Summary: Actually the list of cached files is sorted by file size, not by last accessed time. Also remove unused file access time param for a helper function. Reviewers: joker-eph, chandlerc, davide Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21639 llvm-svn: 273852
* APInt: remove unsued param in private method. NFCPawel Bylica2016-06-271-1/+1
| | | | | | | | | | Reviewers: davide Subscribers: davide, llvm-commits Differential Revision: http://reviews.llvm.org/D21638 llvm-svn: 273851
* [APInt] Don't shift into the sign bitDavid Majnemer2016-06-241-1/+1
| | | | llvm-svn: 273727
* Add support for musl-libc on ARM Linux.Rafael Espindola2016-06-241-0/+5
| | | | | | Patch by Lei Zhang! llvm-svn: 273726
OpenPOWER on IntegriCloud