David Chisnall [Tue, 27 Sep 2011 22:03:18 +0000 (22:03 +0000)]
Check for GCC paths that have the target triple in them. This is required for a lot of cross-compile toolchains. Also add some slightly better support for -B.
Douglas Gregor [Tue, 27 Sep 2011 21:28:10 +0000 (21:28 +0000)]
If you download clang and delete the test directory, you can end up
with the copy line failing with an error, yet the make will complete
successfully. From Greg Clayton!
Douglas Gregor [Tue, 27 Sep 2011 18:58:27 +0000 (18:58 +0000)]
Document the incompatibility that stems from Clang properly implement
the rule that defines the implicit copy constructor/implicit copy
asssignment operator as deleted when a move constructor or move
assignment operator has been explicitly declared. This has hit a
number of people because Boost 1.47.0's shared_ptr fails to declare a
copy constructor.
Douglas Gregor [Tue, 27 Sep 2011 17:00:18 +0000 (17:00 +0000)]
When parsing a character literal, extract the characters from the
buffer as an 'unsigned char', so that integer promotion doesn't
sign-extend character values > 127 into oblivion. Fixes
<rdar://problem/10188919>.
Douglas Gregor [Tue, 27 Sep 2011 16:10:05 +0000 (16:10 +0000)]
Revert r139989 and r140031, which implemented the Objective-C type
system change in <rdar://problem/10109725> that allows conversion from
'self' in class methods to the root of the class's hierarchy. This
conversion rule is a hack that has non-trivial repurcussions
(particularly with overload resolution).
objc - don't complain about unimplemented property when conforming
protocol declares the property, as well as one of its superclasses.
Property will be implemented in the super class. // rdar://10120691
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.
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.
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.
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...
Add a test for the display of diagnostic options and categories. This
would have caught a bug I introduced during refactoring. Silly me
thinking this was all well tested already...
If any of this is already covered by other tests, let me know. I looked
around and didn't see any.
Associate the macro arguments location map with a FileID instead
of a ContentCache, since multiple FileIDs can have the same ContentCache
but the expanded macro arguments locations will be different.
It's not descriptive enough and it's just a call of translateFileLineCol()
followed by a call to getMacroArgExpandedLocation(), which is better to be
called explicitly since it has a certain cost and is not always required.
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.
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.
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.
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.
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.
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.
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.
Sebastian Redl [Sat, 24 Sep 2011 17:48:32 +0000 (17:48 +0000)]
Add a special note for overload resolution when an initializer list argument
cannot be converted.
This is in preparation for overload resolution of initializer lists.
Currently, you will always get this message when you try to pass an init
list to an overloaded function.
Sebastian Redl [Sat, 24 Sep 2011 17:48:25 +0000 (17:48 +0000)]
Correctly parse braced member initializers (even in delayed parsing) and correctly pass
the information on to Sema. There's still an incorrectness in the way template instantiation
works now, but that is due to a far larger underlying representational problem.
Also add a test case for various list initialization cases of scalars, which test this
commit as well as the previous one.
Sebastian Redl [Sat, 24 Sep 2011 17:48:14 +0000 (17:48 +0000)]
Treat list-initialization of scalars as a first-class citizen in C++11.
Allow empty initializer lists for scalars, which mean value-initialization.
Constant evaluation for single-element and empty initializer lists for scalars.
Codegen for empty initializer lists for scalars.
Test case comes in next commit.
Sebastian Redl [Sat, 24 Sep 2011 17:48:00 +0000 (17:48 +0000)]
Give InitListChecker a verification-only mode, where it neither emits diagnostics nor
builds a semantic (structured) initializer list, just reports on whether it can match
the given list to the target type.
Use this mode for doing init list checking in the initial step of initialization, which
will eventually allow us to do overload resolution based on the outcome.
Sebastian Redl [Sat, 24 Sep 2011 17:47:52 +0000 (17:47 +0000)]
In Initialization, add step kind SK_ListConstructorCall (list-initialization
resolves to a constructor call in C++11) and failure kind
FK_ListInitializationFailed (early InitListChecker run failed).