summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Error.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Support] Introduce createStringError helper functionVictor Leschuk2018-07-261-0/+4
| | | | | | | | | | | The function in question is copy-pasted lots of times in DWARF-related classes. Thus it will make sense to place its implementation into the Support library. Reviewed by: lhames Differential Revision: https://reviews.llvm.org/D49824 llvm-svn: 337995
* [Support] Make llvm::Error and Expected faster.Zachary Turner2017-11-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever LLVM_ENABLE_ABI_BREAKING_CHECKS is enabled, which is usually the case for example when asserts are enabled, Error's destructor does some additional checking to make sure that that it does not represent an error condition and that it was checked. However, this is -- by definition -- not the likely codepath. Some profiling shows that at least with some compilers, simply calling assertIsChecked -- in a release build with full optimizations -- can account for up to 15% of the entire runtime of the program, even though this function should almost literally be a no-op. The problem is that the assertIsChecked function can be considered too big to inline depending on the compiler's inliner. Since it's unlikely to ever need to failure path though, we can move it out of line and force it to not be inlined, so that the fast path can be inlined. In my test (using lld to link clang with CMAKE_BUILD_TYPE=Release and LLVM_ENABLE_ASSERTIONS=ON), this reduces link time from 27 seconds to 23.5 seconds, which is a solid 15% gain. llvm-svn: 317824
* Revert "[ADT] Make Twine's copy constructor private."Zachary Turner2017-10-111-1/+1
| | | | | | | | | | This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5. This is failing due to some code that isn't built on MSVC so I didn't catch. Not immediately obvious how to fix this at first glance, so I'm reverting for now. llvm-svn: 315536
* [ADT] Make Twine's copy constructor private.Zachary Turner2017-10-111-1/+1
| | | | | | | | | | | | | | | | | There's a lot of misuse of Twine scattered around LLVM. This ranges in severity from benign (returning a Twine from a function by value that is just a string literal) to pretty sketchy (storing a Twine by value in a class). While there are some uses for copying Twines, most of the very compelling ones are confined to the Twine class implementation itself, and other uses are either dubious or easily worked around. This patch makes Twine's copy constructor private, and fixes up all callsites. Differential Revision: https://reviews.llvm.org/D38767 llvm-svn: 315530
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* Fix a linefeed at eof.NAKAMURA Takumi2016-11-291-1/+1
| | | | llvm-svn: 288167
* Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatchMehdi Amini2016-11-281-0/+15
| | | | | | | | | | | | | | | | | | | | The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header abi-breaking.h, from llvm-config.h. Only headers that are using the macro are including this new header. LLVM will define a symbol, either EnableABIBreakingChecks or DisableABIBreakingChecks depending on the configuration setting for LLVM_ABI_BREAKING_CHECKS. The abi-breaking.h header will add weak references to these symbols in every clients that includes this header. This should ensure that a mismatch triggers a link failure (or a load time failure for DSO). On MSVC, the pragma "detect_mismatch" is used instead. Differential Revision: https://reviews.llvm.org/D26876 llvm-svn: 288082
* Revert "Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch"Mehdi Amini2016-11-181-16/+0
| | | | | | This reverts commit r287352, LLDB CI is broken. llvm-svn: 287374
* Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatchMehdi Amini2016-11-181-0/+16
| | | | | | | | | | | | | | | | | | | | | Summary: LLVM will define a symbol, either EnableABIBreakingChecks or DisableABIBreakingChecks depending on the configuration setting for LLVM_ABI_BREAKING_CHECKS. The llvm-config.h header will add weak references to these symbols in every clients that includes this header. This should ensure that a mismatch triggers a link failure (or a load time failure for DSO). On MSVC, the pragma "detect_mismatch" is used instead. Reviewers: rnk, jroelofs Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26841 llvm-svn: 287352
* Remove LLVM_NOEXCEPT and replace it with noexceptReid Kleckner2016-10-191-1/+1
| | | | | | | Now that we have dropped MSVC 2013, all supported compilers support noexcept and we can drop this portability macro. llvm-svn: 284672
* Missing includes.Vassil Vassilev2016-09-141-0/+1
| | | | llvm-svn: 281450
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-141-0/+11
| | | | llvm-svn: 275361
* [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][Error] Make logAllUnhandledErrors take a Twine for the banner, ratherLang Hames2016-07-041-0/+9
| | | | | | than a const string&. llvm-svn: 274526
* Linker: teach the IR mover to return llvm::Error.Peter Collingbourne2016-05-271-1/+0
| | | | | | | | | This will be needed in order to consistently return an Error to clients of the API being developed in D20268. Differential Revision: http://reviews.llvm.org/D20550 llvm-svn: 270967
* [Support] Rename unconvertibleErrorCode to inconvertibleErrorCode.Lang Hames2016-05-271-6/+6
| | | | | | | 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-4/+48
| | | | | | | | 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
* Add FIXMEs to all derived classes of std::error_category.Peter Collingbourne2016-05-241-0/+3
| | | | | | | | This helps make clear that we're moving away from std::error_code. Differential Revision: http://reviews.llvm.org/D20592 llvm-svn: 270604
* Try to fix ODR violation of ErrorInfo::IDReid Kleckner2016-03-241-3/+2
| | | | | | This implements my suggestion to Lang. llvm-svn: 264360
* Define ErrorInfo::ID explicitly.NAKAMURA Takumi2016-03-241-0/+3
| | | | llvm-svn: 264293
* Error.cpp: Fix a warning. [-Wpedantic]NAKAMURA Takumi2016-03-241-1/+1
| | | | llvm-svn: 264291
* [Support] Make all Errors convertible to std::error_code.Lang Hames2016-03-231-0/+45
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
OpenPOWER on IntegriCloud