Richard Smith [Thu, 29 Sep 2011 19:11:37 +0000 (19:11 +0000)]
constexpr: semantic checking for constexpr variables.
We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).
Add support for alignment-specifiers in C1X and C++11, remove
support for the C++0x draft [[align]] attribute and add the C1X
standard header file stdalign.h
John McCall [Thu, 29 Sep 2011 07:17:38 +0000 (07:17 +0000)]
Add an ns_bridged attribute, used to specify that a
pointer to the annotated struct type can be used as an
Objective-C object pointer. If an argument is given, the
type is actually "toll-free bridged" to the specific type
named there, rather than just to 'id'.
For now, we cannot rely on all types being so annotated,
and we'll always have to have exceptions for things like
CFTypeRef (aka const void*), but this is clearly a good
foundation for improving toolage in this area.
Daniel Dunbar [Thu, 29 Sep 2011 02:03:01 +0000 (02:03 +0000)]
Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state.
Daniel Dunbar [Thu, 29 Sep 2011 01:58:05 +0000 (01:58 +0000)]
Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings.
- This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about.
Daniel Dunbar [Thu, 29 Sep 2011 01:52:06 +0000 (01:52 +0000)]
Basic/Diagnostics: Add three explicit bits to DiagnosticMappingInfo to track "no-warning-as-error", "no-error-as-fatal", and "show-in-system-header", and update DiagnosticsEngine::setDiagnosticGroup{WarningAsError,ErrorAsFatal} and GetDefaultDiagMappingInfo to set them appropriately.
- No actual functionality change for now, we still also use the diag::Mapping::{MAP_WARNING_NO_ERROR,MAP_ERROR_NO_FATAL,MAP_WARNING_SHOW_IN_SYSTEM_HEADER} for a little while longer.
Daniel Dunbar [Thu, 29 Sep 2011 01:47:16 +0000 (01:47 +0000)]
Basic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and use
that in DiagnosticEngine instead of the convoluted calling into DiagnosticIDs
which then calls back into the DiagnosticsEngine.
Daniel Dunbar [Thu, 29 Sep 2011 01:30:00 +0000 (01:30 +0000)]
Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the
source.
Daniel Dunbar [Thu, 29 Sep 2011 01:01:08 +0000 (01:01 +0000)]
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.
Daniel Dunbar [Thu, 29 Sep 2011 00:53:47 +0000 (00:53 +0000)]
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.
Douglas Gregor [Thu, 29 Sep 2011 00:38:00 +0000 (00:38 +0000)]
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.
Daniel Dunbar [Thu, 29 Sep 2011 00:34:06 +0000 (00:34 +0000)]
Basic/Diagnostics: Split out the default warning "no-Werror" and
"show-in-system-header" bits, which is part of teasing them apart from the
diagnostic mapping kind.
Eric Christopher [Thu, 29 Sep 2011 00:00:35 +0000 (00:00 +0000)]
Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.
objc arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This is objc side of
// rdar://10187884
objc++ arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This fixes the objc++ side only *auch*.
// rdar://10187884
Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when in GC-only mode, and to not warning about missing [super finalize] when not using GC.
Simplify the control flow for predefined macro selection by using
fallthrough now that we're working with a switch. Also remove a dubious
"feature" regarding k6 processors and 3dnow and leave a fixme... Not
that anyone is likely to care about correct tuning for k6 processors
with and w/o 3dnow...
Switch the X86TargetInfo object from a string representation of the
selected CPU model to the enumeration. This parses the string
representation once using a StringSwitch on SetCPU. It returns an error
for strings which are not recognized (yay!). Finally it replaces
ridiculous if-chains with switches that cover all enumerators.
The last change required adding several missing entries to the features
function. These were obvious on inspection. Yay for a pattern that gives
warnings when we miss one.
No new test cases yet, as I want to get the 64-bit errors working first.
I'll then start fleshing out the testing more. Currently I'm primarily
testing on Linux, but I'm hoping check whether there are interesting
differences on darwin before long...
Introduce an enumeration for the x86 CPUs recognized by Clang. I've
tried to give these nice doxyments, but if I've gotten any of my history
wrong, please chime in.
Clean up a bit of the uses of CPU in the TargetInfo classes. This makes
it an error if a CPU is provided for a target that doesn't implement
logic handling CPU settings, to match the ABI settings. It also removes
the CPU parameter from the getDefaultFeatures method. This parameter was
always filled in with the same value as setCPU was called with, and at
this point every single target implementation that referenced the CPU
within this function has needed to store the CPU via setCPU anyways in
order to implement other interface points.
Begin fixing Clang's predefined macros for various architectures. This
is *very* much a WIP that I'll be refining over the next several
commits, but I need to get this checkpoint in place for sanity.
This also adds a much more comprehensive test for architecture macros,
which is roughly generated by inspecting the behavior of a trunk build
of GCC. It still requires some massaging, but eventually I'll even check
in the script that generates these so that others can use it to append
more tests for more architectures, etc.
Next up is a bunch of simplification of the Targets.cpp code, followed
by a lot more test cases once we can reject invalid architectures.
Introduce Decl::getParentFunctionOrMethod which if the decl is defined inside
a function/method/block it returns the corresponding DeclContext, otherwise it returns null.
Eli Friedman [Tue, 27 Sep 2011 23:46:37 +0000 (23:46 +0000)]
PR11002: Make sure we emit sentinel warnings with a valid source location. (Ideally, we want to use the location returned by getLocForEndOfToken, but that is not always successful.)
Douglas Gregor [Tue, 27 Sep 2011 22:48:19 +0000 (22:48 +0000)]
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>.
Douglas Gregor [Tue, 27 Sep 2011 22:38:19 +0000 (22:38 +0000)]
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>.
objcetive-c-arc: When overriding a method, its ns_consumed patameter
attribute must match its overriden method. Same also for
ns_returns_retained/not_retained on the result type.
This is one half of // rdar://10187884
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