Daniel Dunbar [Wed, 15 Apr 2009 19:52:32 +0000 (19:52 +0000)]
Don't use \01 in symbol name if unnecessary.
- This was particularly bad since I fixed one instance of this name
and not another, meaning we got an LLVM module with the same
effective name in two different globals!
Patch to remove a bogus warning which pointed to underlying AST
gen. issue for property in continuation class declared readwrite
but which did not generate the declaration for the setter. Fix also
removed a FIXME and resulted in code cleanup.
Chris Lattner [Wed, 15 Apr 2009 18:08:55 +0000 (18:08 +0000)]
annotate diagnostics with which groups they belong to. Each
diagnostic can belong to at most one group. Each group can
contain multiple diags, but we have nice syntax for the common
case of "1 diag to one group".
Douglas Gregor [Wed, 15 Apr 2009 18:05:10 +0000 (18:05 +0000)]
For source location entries that describe instantiations, encode the
token length in the PCH file rather than trying (and failing) to
reconstruct it be getting the spelling token's length.
Chris Lattner [Wed, 15 Apr 2009 16:56:26 +0000 (16:56 +0000)]
Make diagnostic class explicit in the diag record instead of
implicit from its parenting. Now that diag mapping is
explicit, eliminate the fatal and extwarn classes.
caused by: <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.
Sema::RecursiveCalcLabelScopes() and Sema::RecursiveCalcJumpScopes() need to pop the ScopeStack within the statement iteration loop (was outside the loop).
Chris Lattner [Wed, 15 Apr 2009 07:01:18 +0000 (07:01 +0000)]
Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or
-Werror=foo all override the -pedantic options, and __extension__
robustly silences all extension diagnostics in their scope.
An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array. This also
substantially simplifies Diagnostic::getDiagnosticLevel.
OTOH, this temporarily introduces some "macro intensive" code in
Diagnostic.cpp. This will be addressed in a later patch.
Chris Lattner [Wed, 15 Apr 2009 04:27:38 +0000 (04:27 +0000)]
refactor a bunch of the warning parsing stuff to simplify it. This removes the
-Wfoo=ignore syntax. GCC supports -Wno-foo, no need to invent our own stuff.
Daniel Dunbar [Wed, 15 Apr 2009 02:56:18 +0000 (02:56 +0000)]
Tweaks to Objective-C metadata (32 & 64-bit) to match llvm-gcc.
- Set alignment on property lists.
- 32-bit:
o Set section on property lists.
o Fix section name for category class methods.
o Fix symbol name for property lists.
o Fix section name for class method.
o Set alignment and section on class extension structure.
o Set alignment on a number of things: instance variables, methods,
method descriptions, the symbols structure.
- 64-bit:
o Fix section flags for protocol list.
I doubt most of these were problems in practice, but it is nice to
match llvm-gcc.
Daniel Dunbar [Wed, 15 Apr 2009 02:37:43 +0000 (02:37 +0000)]
Driver: For clang, accept -fsigned-bitfields and reject
-funsigned-bitfields for now (clang defaults to -fsigned-bitfields).
- <rdar://problem/6790309> ER: Support
-fsigned-bitfields/-funsigned-bitfields
Daniel Dunbar [Wed, 15 Apr 2009 00:08:05 +0000 (00:08 +0000)]
Improve "assignment to cast" diagnostic.
- Strip off extra parens when looking for casts.
- Change the location info to point at the cast (instead of the
assignment).
For example, on
int *b;
#define a ((void*) b)
void f0() {
a = 10;
}
we now emit:
/tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported
a = 10;
^ ~
/tmp/t.c:2:12: note: instantiated from:
#define a ((void*) b)
~^~~~~~~~~~
instead of:
/tmp/t.c:4:5: error: expression is not assignable
a = 10;
~ ^
Douglas Gregor [Tue, 14 Apr 2009 23:32:43 +0000 (23:32 +0000)]
Add PCH support for ImplicitCastExprs. This is the first expression
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.
Douglas Gregor [Tue, 14 Apr 2009 21:18:50 +0000 (21:18 +0000)]
PCH support for a few very, very simple kinds of expressions. Hook up
expression (de-)serialization for VLAs, variable initializers,
enum constant initializers, and bitfield widths.
Literal value calculation isn't likely to overflow on targets having int as 32 or less. Fixing the assert as it otherwise triggers for PIC16 which as i16 as int.
Douglas Gregor [Tue, 14 Apr 2009 16:27:31 +0000 (16:27 +0000)]
When building a PCH file, don't perform end-of-translation-unit
wrap-up (e.g., turning tentative definitions into definitions). Also,
very that, when we actually use the PCH file, we get the ride code
generation for tentative definitions and definitions that show up in
the PCH file.
Steve Naroff [Tue, 14 Apr 2009 15:11:46 +0000 (15:11 +0000)]
ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods.
The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id').
I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'.
All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings).
Daniel Dunbar [Tue, 14 Apr 2009 08:05:55 +0000 (08:05 +0000)]
Refactor how attributes are set on values.
- Pull out SetCommonAttributes, which handles the things common to
aliases, methods, functions, and variables.
- Pull out SetLLVMFunctionAttributesForDefinition, which handles the
LLVM attributes which we only want to apply to a definition (like
noinline and alwaysinline).
- Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
and specialized).
- Kill SetFunctionAttributesForDefinition (inlined into sole caller).
- Inline SetGVDefinitionAttributes into SetMethodAttributes and
specialize.
- Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.
This is supposed to be a no functionality change commit, but I may
have made a mistake.
Chris Lattner [Tue, 14 Apr 2009 05:07:49 +0000 (05:07 +0000)]
Fix the #import / #include_next "extra tokens at end of #foo directive"
Warning to properly report that it is an import/include_next instead of
claiming it is a #include.
Daniel Dunbar [Tue, 14 Apr 2009 02:25:56 +0000 (02:25 +0000)]
Audit __private_extern__ handling.
- Exposed quite a few Sema issues and a CodeGen crash.
- See FIXMEs in test case, and in SemaDecl.cpp (PR3983).
I'm skeptical that __private_extern__ should actually be a storage
class value. I think that __private_extern__ basically amounts to
extern A __attribute__((visibility("hidden")))
and would be better off handled (a) as that, or (b) with an extra bit
in the VarDecl.
Douglas Gregor [Tue, 14 Apr 2009 00:24:19 +0000 (00:24 +0000)]
When writing a PCH file, keep track of all of the non-static,
non-inline external definitions (and tentative definitions) that are
found at the top level. The corresponding declarations are stored in a
record in the PCH file, so that they can be provided to the
ASTConsumer (via HandleTopLevelDecl) when the PCH file is read.