Commit Graph

40 Commits

Author SHA1 Message Date
Chandler Carruth
1b279144ec [cleanup] Re-sort all the #include lines in LLVM using
utils/sort_includes.py.

I clearly haven't done this in a while, so more changed than usual. This
even uncovered a missing include from the InstrProf library that I've
added. No functionality changed here, just mechanical cleanup of the
include order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:23:27 +00:00
Chris Bieneman
be77ea38e6 Converting the ErrorHandlerMutex to a ManagedStatic to avoid the static constructor and destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219028 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-03 22:03:12 +00:00
Rafael Espindola
476fd7c3e9 Merge lib/Support/WindowsError.cpp into ib/Support/ErrorHandling.cpp.
The OSX ranlib warns on files with no symbols, and lib/Support/WindowsError.cpp
was empty when building on non-windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211118 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 18:06:45 +00:00
Zachary Turner
89e90b25e3 Make the error-handling functions thread-safe.
Prior to this change, error handling functions must be installed
and removed only inside of an llvm_[start/stop]_multithreading
pair.  This change allows error handling functions to be installed
any time, and from any thread.

Reviewed by: chandlerc

Differential Revision: http://reviews.llvm.org/D4140

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210937 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 21:20:44 +00:00
Zachary Turner
63ce00b72f Revert "Remove support for runtime multi-threading."
This reverts revision r210600.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210603 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 23:15:43 +00:00
Zachary Turner
529e9d307e Remove support for runtime multi-threading.
This patch removes the functions llvm_start_multithreaded() and
llvm_stop_multithreaded(), and changes llvm_is_multithreaded()
to return a constant value based on the value of the compile-time
definition LLVM_ENABLE_THREADS.

Previously, it was possible to have compile-time support for
threads on, and runtime support for threads off, in which case
certain mutexes were not allocated or ever acquired.  Now, if the
build is created with threads enabled, mutexes are always acquired.

A test before/after patch of compiling a very large TU showed no
noticeable performance impact of this change.

Reviewers: rnk

Differential Revision: http://reviews.llvm.org/D4076

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210600 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 23:01:20 +00:00
Craig Topper
34bc6b6e78 [C++11] Make use of 'nullptr' in the Support library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-07 04:17:22 +00:00
Alp Toker
650e286dcf Roll back the ConstStringRef change for now
There are a couple of interesting things here that we want to check over
(particularly the expecting asserts in StringRef) and get right for general use
in ADT so hold back on this one. For clang we have a workable templated
solution to use in the meanwhile.

This reverts commit r200187.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200194 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-27 05:24:39 +00:00
Alp Toker
bad91954cf StringRef: Extend constexpr capabilities and introduce ConstStringRef
(1) Add llvm_expect(), an asserting macro that can be evaluated as a constexpr
    expression as well as a runtime assert or compiler hint in release builds. This
    technique can be used to construct functions that are both unevaluated and
    compiled depending on usage.

(2) Update StringRef using llvm_expect() to preserve runtime assertions while
    extending the same checks to static asserts in C++11 builds that support the
    feature.

(3) Introduce ConstStringRef, a strong subclass of StringRef that references
    compile-time constant strings. It's convertible to, but not from, ordinary
    StringRef and thus can be used to add compile-time safety to various interfaces
    in LLVM and clang that only accept fixed inputs such as diagnostic format
    strings that tend to get misused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200187 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-27 04:07:17 +00:00
Chandler Carruth
974a445bd9 Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-07 11:48:04 +00:00
Alexey Samsonov
b21ab43cfc Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-18 09:31:53 +00:00
Juergen Ributzka
5a364c5561 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 22:34:48 +00:00
Alp Toker
16da44c562 Fix the -Werror -Wpedantic clang selfhost build
This is a stopgap fix for cast warnings introduced in r192864.

A proper fix should be investigated by the author when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193160 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22 12:30:55 +00:00
Filip Pizlo
0739140b05 Expose install_fatal_error_handler() through the C API.
I expose the API with some caveats:

- The C++ API involves a traditional void* opaque pointer for the fatal 
error callback.  The C API doesn’t do this.  I don’t think that the void* 
opaque pointer makes any sense since this is a global callback - there will 
only be one of them.  So if you need to pass some data to your callback, 
just put it in a global variable.

- The bindings will ignore the gen_crash_diag boolean.  I ignore it because 
(1) I don’t know what it does, (2) it’s not documented AFAIK, and (3) I 
couldn’t imagine any use for it.  I made the gut call that it probably 
wasn’t important enough to expose through the C API.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-17 01:38:28 +00:00
Reid Kleckner
e7ff008462 [Support] Fix some warnings when self-hosting clang on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186413 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 14:04:08 +00:00
Chad Rosier
ce945578ee Add a boolean parameter to the llvm::report_fatal_error() function to indicated
if crash diagnostics should be generated.  By default this is enabled.
Part of rdar://13296693


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178161 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27 18:27:54 +00:00
Chandler Carruth
d04a8d4b33 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 16:50:05 +00:00
Chad Rosier
fc298c76c7 Revert 167755/167760. We don't want to emit crash diagnostics on command-line syntax errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13 16:42:19 +00:00
Chad Rosier
f4e3309e84 Revert r167620; this can be implemented using an existing CL option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167755 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 21:32:44 +00:00
Jay Foad
a0f5092703 Like the coding standards say, do not use "using namespace std".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-23 09:06:00 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Daniel Dunbar
afd693cff3 report_fatal_error: Simplify a possible ambiguity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 02:48:51 +00:00
Duncan Sands
dd2fdd81bc Some versions of gcc still warn about "ignoring return value ... declared
with attribute warn_unused_result" here - suppress the warning harder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 08:20:49 +00:00
Dan Gohman
d77e5a8176 Tidy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 22:04:43 +00:00
Chris Lattner
7942e3c412 include config.h to get config params, hopefully unbreaking mingw builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111325 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 23:22:10 +00:00
Chris Lattner
73ebaff79f report_fatal_error can't use errs(), because errs() can call
into report_fatal_error.  Just blast the string to stderr with write(2)
and hope for the best!  Part of rdar://8318441


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 23:03:53 +00:00
Daniel Dunbar
d547708976 Run interrupt routines as part of report_fatal_error, since we are failing
ungracefully.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103334 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 02:10:36 +00:00
Chris Lattner
b0094c2404 rename llvm_install_error_handler -> install_fatal_error_handler
and friends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:12:29 +00:00
Chris Lattner
75361b69f3 rename llvm::llvm_report_error -> llvm::report_fatal_error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:58:41 +00:00
Dan Gohman
16e02097d2 Fix minor style issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 19:38:02 +00:00
David Greene
af6c8cc272 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 01:28:29 +00:00
Dan Gohman
073f5b669d Add a comment explaining why llvm_unreachable_internal doesn't call
the ErrorHandler callback.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79541 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 17:15:19 +00:00
Dan Gohman
a9ad04191c This void is implicit in C++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 22:10:57 +00:00
Daniel Dunbar
ca15f3d6d6 Add support for a user supplied pointer argument to llvm_install_error_handler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 03:36:26 +00:00
Daniel Dunbar
82a29b6a02 Allow llvm_report_error to accept a Twine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 07:58:10 +00:00
Torok Edwin
c23197a26f llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 16:55:14 +00:00
Torok Edwin
93990d775e After converting assert(0) to LLVM_UNREACHABLE we lost file/line location.
Fix by making the LLVM_UNREACHABLE pass __FILE__ and __LINE__ to
llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 12:49:22 +00:00
Torok Edwin
c25e7581b9 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 20:10:48 +00:00
Torok Edwin
f361238a93 Fix braces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:39:53 +00:00
Torok Edwin
31e2466f15 Introduce new error handling API.
This will replace exit()/abort() style error handling with an API
that allows clients to register custom error handling hooks.
The default is to call exit(1) when no error handler is provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:32:34 +00:00