summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Error.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Error] Remove a broken code fragment accidentally included in 76bcbaafab2.Lang Hames2019-11-201-2/+0
|
* [Orc][Modules] Fix Modules build fallout from a34680a33eb.Lang Hames2019-11-201-2/+5
| | | | | | | | | | | | In a34680a33eb OrcError.h and Orc/RPC/*.h were split out from the rest of ExecutionEngine in order to eliminate false dependencies for remote JIT targets (see https://reviews.llvm.org/D68732), however this broke modules builds (see https://reviews.llvm.org/D69817). This patch splits these headers out into a separate module, LLVM_OrcSupport, in order to fix the modules build. Fixes <rdar://56377508>.
* Move LLVM_ENABLE_ABI_BREAKING_CHECKS variables to their own fileEric Christopher2019-09-101-15/+0
| | | | | | | | | | | | | so that you don't have to link Error.o and all of its dependencies. In more detail: global initializers in Error.o can't be elided with -ffunction-sections/-gc-sections since they always need to be run causing a fairly significant binary bloat if all you want is the ABI breaking checks code. Differential Revision: https://reviews.llvm.org/D67387 llvm-svn: 371561
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-1/+1
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [NFC] Fixed extra semicolon warningDavid Bolvansky2018-12-301-1/+1
| | | | | | | | -This line, and those below, will be ignored-- M lib/Support/Error.cpp llvm-svn: 350162
* Add vtable anchor to classes.Richard Trieu2018-12-291-0/+1
| | | | llvm-svn: 350142
* [Support] Make error banner optional in logAllUnhandledErrorsJonas Devlieghere2018-11-111-1/+1
| | | | | | | | In a lot of places an empty string was passed as the ErrorBanner to logAllUnhandledErrors. This patch makes that argument optional to simplify the call sites. llvm-svn: 346604
* [Error] Add FileError helper; upgrade StringError behaviorAlexandre Ganea2018-08-301-2/+22
| | | | | | | | | | | | | | | | FileError is meant to encapsulate both an Error and a file name/path. It should be used in cases where an Error occurs deep down the call chain, and we want to return it to the caller along with the file name. StringError was updated to display the error messages in different ways. These can be: 1. display the error_code message, and convert to the same error_code (ECError behavior) 2. display an arbitrary string, and convert to a provided error_code (current StringError behavior) 3. display both an error_code message and a string, in this order; and convert to the same error_code These behaviors can be triggered depending on the constructor. The goal is to use StringError as a base class, when a library needs to provide a explicit Error type. Differential Revision: https://reviews.llvm.org/D50807 llvm-svn: 341064
* [Support] Add a basic C API for llvm::Error.Lang Hames2018-08-151-0/+20
| | | | | | | | | | | | | | | | Summary: The C-API supports consuming errors, converting an error to a string error message, and querying an error's type. Other LLVM C APIs that wish to use llvm::Error can supply error-type-id checkers and custom error-to-structured-type converters for any custom errors they provide. Reviewers: bogner, zturner, labath, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50716 llvm-svn: 339802
* [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