Commit Graph

2069 Commits

Author SHA1 Message Date
Bob Wilson 05de0298d2 Rip out flags for controlling C++ "production mode" separately.
This is old leftover cruft from the days when C++ was not yet ready
for prime time.

llvm-svn: 141063
2011-10-04 05:34:14 +00:00
Douglas Gregor 51e0b54197 When build a module on demand, run the module-building job on a
separate thread with the "suitably large" stack, so we don't blow the
stack when building modules recursively.

llvm-svn: 141051
2011-10-04 00:21:21 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
Anna Zaks 8d4c8e1498 [analyzer] Add -analyzer-purge option which can take on multiple values, remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.)
llvm-svn: 140838
2011-09-30 02:03:00 +00:00
Daniel Dunbar aa11138543 Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
- The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though.

llvm-svn: 140752
2011-09-29 01:01:08 +00:00
Daniel Dunbar c2e5ca6e50 Basic/Diagnostic: Factor out
DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which
more accurately model the correct API -- no internal change to the diagnostics
engine yet though.
 - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option.

llvm-svn: 140747
2011-09-29 00:53:47 +00:00
Douglas Gregor 44e688d46a Introduce an opt-in warning when a module is being implicitly built
from sources.

llvm-svn: 140746
2011-09-29 00:52:27 +00:00
Douglas Gregor d0e9e3a6a5 Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.

llvm-svn: 140743
2011-09-29 00:38:00 +00:00
Chad Rosier 011824f747 [driver] Add basic support for escaping XML characters in CC_LOG_DIAGNOSTICS
strings.
rdar://9696709

llvm-svn: 140732
2011-09-28 23:05:07 +00:00
Douglas Gregor eaed8d57dd Remove the egregious hack that made Objective-C++ ARC work with older
versions of libc++. Newer versions of libc++ know how to deal with ARC
properly. Fixes <rdar://problem/10062179>.

llvm-svn: 140651
2011-09-27 22:48:19 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
Chandler Carruth 374eaa9c4e Add back support for a manually formatted section of the diagnostic
message. Specifically, we now only line-wrap the first line of te
diagnostic message and assume the remainder is manually formatted. While
adding it back, simplify the logic for doing this.

Finally, add a test that ensures we actually preserve this feature. =D
*Now* its not dead code. Thanks to Doug for the test case.

llvm-svn: 140538
2011-09-26 16:43:25 +00:00
Chandler Carruth 577372ea15 Hoist and beef up the asserts about the level of infrastructure expected
when working with a diagnostic attached to a source location. Also
comment more thoroughly why its important to handle non-location
diagnostic messages separately.

Finally, hoist the creation of the TextDiagnostic object up to the
beginning of the location-based diagnostics. This paves the way for
sinking more and more of the logic into this class. When everything
below this constructor is sunk into the TextDiagnostic class it should
be sufficiently "feature complete" to accomplish my two goals:
1) Have the printing of a macro expansion note use the exact same code
   as any other note.
2) Be able to implement clang_formatDiagnostic in terms of this class.

llvm-svn: 140526
2011-09-26 11:38:46 +00:00
Chandler Carruth 2be992d570 Switch the emission of diagnostics without a source location to
a dedicated path. The logic for such diagnostics is much simpler than
for others.

This begins to make an important separation in this routine. We expect
most (and most interesting) textual diagnostics to be made in the
presence of at least *some* source locations and a source manager.
However the DiagnosticConsumer must be prepared to diagnose errors even
when the source manager doesn't (yet) exist or when there is no location
information at all. In order to sink more and more logic into the
TextDiagnostic class while minimizing its complexity, my plan is to
force the DiagnosticConsumer to special case diagnosing any locationless
messages and then hand the rest to the TextDiagnostic class. I'd
appreciate any comments on this design. It requires a bit of code
duplication in order to keep interfaces simple. Alternatively, if we
really need TextDiagnostic to be capable of handling diagnostics even in
the absence of a viable SourceManager, then this split isn't necessary.

llvm-svn: 140525
2011-09-26 11:25:30 +00:00
Chandler Carruth c0fe585e0c Extract the actual printing of the message string into a helper
function. Doing this conveniently requires moving the word wrapping to
use a StringRef which seems generally an improvement. There is a lot
that could be simplified in the word wrapping by using StringRef that
I haven't looked at yet...

llvm-svn: 140524
2011-09-26 11:19:35 +00:00
Chandler Carruth bae3c7c833 Group the helpers for word wrapping with the primary routine. No
functionality changed.

llvm-svn: 140523
2011-09-26 10:58:00 +00:00
Argyrios Kyrtzidis 4cdfcae75d Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble.

Instead, handle specially locations of preprocessed entities:
-When looking up for preprocessed entities, map main file locations inside the
 preamble range to a preamble loaded location.
-When getting the source range of a preprocessing cursor, map preamble loaded
 locations back to main file locations.

Fixes rdar://10175093 & http://llvm.org/PR10999

llvm-svn: 140519
2011-09-26 08:01:41 +00:00
Benjamin Kramer e2125d8278 Don't print a stray ] at the end of diagnostics.
Also remove an obsolete utostr call.

llvm-svn: 140511
2011-09-26 02:14:13 +00:00
Chandler Carruth d16b42ef92 Remove support for splitting word-wrapped diagnostic messages on newline
characters. I could find no newline character in a diagnostic message,
and adding an assert to this code never fires in the testsuite.

I think this code is essentially dead, and was previously used for
a different purpose. If I just don't understand how it is we can end up
with a newline here please let me know (with a test case?) and I'll
revert.

llvm-svn: 140497
2011-09-26 01:44:29 +00:00
Chandler Carruth b1e536bb3a Move the word wrapped printing routine down to all the other helper
printing routines, clean up its doxyments and switch it to a camelCase
name as well. No functionality changed here.

llvm-svn: 140496
2011-09-26 01:44:27 +00:00
Chandler Carruth cf259a47e2 Switch some of my recently added helper functions to use the proper
style, and add doxyments.

llvm-svn: 140495
2011-09-26 01:30:09 +00:00
Chandler Carruth 0059a9bee0 Rewrite the printing of diagnostic options, categories, etc to actually
use the ostream interface and avoid lots of temporary strings.

llvm-svn: 140494
2011-09-26 01:21:58 +00:00
David Blaikie b5784324b3 Rename DiagnosticInfo to Diagnostic as per issue 5397
llvm-svn: 140493
2011-09-26 01:18:08 +00:00
Chandler Carruth 292e76939b Delete an extraneous line I missed.
llvm-svn: 140491
2011-09-26 00:45:02 +00:00
Chandler Carruth 6074084fa8 A direct extraction of the rest of the option printing into a helper.
This needs to be cleaned up to better use the ostream object, WIP.

llvm-svn: 140490
2011-09-26 00:44:09 +00:00
David Blaikie 69609dcead Rename VerifyDiagnosticsClient to VerifyDiagnosticConsumer as per issue 5397
llvm-svn: 140489
2011-09-26 00:38:03 +00:00
Chandler Carruth b59f9cb9ce Start a more correct pattern for factoring out the name printing. Slowly
I'm planning to switch a bunch of these over to use a raw_ostream
instead of += on a string object.

llvm-svn: 140488
2011-09-26 00:37:30 +00:00
Chandler Carruth 09c65ce3a3 Revert r140484. That was *not* ready to be committed! Only halfway done,
and completely broken at that.

Sorry, must remember to stash rather than commit. =]

llvm-svn: 140487
2011-09-26 00:26:47 +00:00
Chandler Carruth 6849652cf8 Fix a formatting goof.
llvm-svn: 140486
2011-09-26 00:21:50 +00:00
David Blaikie 8b00dcb03b Rename ChainedDiagnosticClient to ChainedDiagnosticConsumer as per issue 5397
llvm-svn: 140485
2011-09-26 00:21:47 +00:00
Chandler Carruth b7e3f42a01 Extract the diagnostic message formatting into a helper routine.
llvm-svn: 140484
2011-09-26 00:21:47 +00:00
David Blaikie f18d91a4b2 Rename StoredDiagnosticClient to StoredDiagnosticConsumer as per issue 5397
llvm-svn: 140483
2011-09-26 00:01:39 +00:00
Chandler Carruth 0216058a97 Extract the logic for printing a colorful level name into a helper
function.

llvm-svn: 140481
2011-09-25 23:51:01 +00:00
David Blaikie e2eefaecc8 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
llvm-svn: 140479
2011-09-25 23:39:51 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Chandler Carruth 74e2c35fbc Inline this method now that its completely trivial, and prepare for
hoisting parts of the text diagnostic.

llvm-svn: 140477
2011-09-25 23:01:05 +00:00
Chandler Carruth 84f361950f Shuffle some names around. 'CaretDiagnostic' is inaccurate as this needs
to handle non-caret diagnostics as well in order to be fully useful in
libclang etc. Also sketch out some more of my plans on this refactoring.

llvm-svn: 140476
2011-09-25 22:54:56 +00:00
Chandler Carruth 3236f0d25c Actually remove the members of CaretDiagnostic no longer in use for
tracking the start and stop of macro expansion suppression. Also remove
the Columns variable which was just a convenience variable based on
DiagOpts. Instead we materialize it in the one piece of code that cared.

llvm-svn: 140475
2011-09-25 22:31:58 +00:00
Chandler Carruth cb8f82a8e5 Sink the logic for suppressing some macro expansion notes from the
TextDiagnosticPrinter into the CaretDiagnostic class. Several
interesting results from this:

- This removes a significant per-diagnostic bit of state from the
  CaretDiagnostic class, which should eventually allow us to re-use the
  object.
- It removes a redundant recursive walk of the macro expansion stack
  just to compute the depth. We don't need the depth until we're
  unwinding anyways, so we can just mark when we reach it.
- It also paves the way for several simplifications we can do to how we
  implement the suppression.

llvm-svn: 140474
2011-09-25 22:27:52 +00:00
Chandler Carruth 9d229f3eb1 Split the recursive macro expansion walk out from the routine which
emits a source snippet and caret line.

llvm-svn: 140467
2011-09-25 06:59:38 +00:00
Douglas Gregor 52da28be50 Don't translate CRLF files into LF files. Fixes PR6870, from Aaron Ballman!
llvm-svn: 140435
2011-09-23 23:43:36 +00:00
David Blaikie 7900020616 More missing header inclusions from llvm_unreachable migration.
llvm-svn: 140369
2011-09-23 05:57:42 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Benjamin Kramer 559865c89d Reenable -cxx-isystem for Objective C++, until I come up with a better solution
llvm-svn: 140365
2011-09-23 02:25:14 +00:00
Benjamin Kramer 8404eb0bad Add support for CPATH and friends.
This moves the existing code for CPATH into the driver and adds the environment lookup and path splitting there.
The paths are then passed down to cc1 with -I options (CPATH), added after the normal user-specified include dirs.
Language specific paths are passed via -LANG-isystem and the actual filtering is performed in the frontend.

I tried to match GCC's behavior as close as possible

Fixes PR8971.

llvm-svn: 140341
2011-09-22 21:41:16 +00:00
Tobias Grosser 0a3a22fe66 In the OpenCL mode, the AltiVec mode must be off and checks must be strict
OpenCL is different from AltiVec in the way it supports vector literals.  OpenCL
is strict with regards to semantic checks.  For example, implicit conversions
and explicit casts between vectors of different types are disallowed.

Fixes PR10975. Submitted by: Anton Lokhmotov <Anton.lokhmotov@gmail.com>

llvm-svn: 140270
2011-09-21 18:28:29 +00:00
Eric Christopher 5507159245 Remove __WCHAR_UNSIGNED__ and anything that used it.
llvm-svn: 140155
2011-09-20 18:05:01 +00:00
Argyrios Kyrtzidis 5733271925 In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

llvm-svn: 140063
2011-09-19 20:40:48 +00:00
Argyrios Kyrtzidis 7f44836998 Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.

llvm-svn: 140062
2011-09-19 20:40:42 +00:00
Argyrios Kyrtzidis 7c06d8666b [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

llvm-svn: 140060
2011-09-19 20:40:35 +00:00