Default synthesized ivars don't really have a location in the source. Using the location of the @implementation
is just confusing for clients that want to use SourceLocations for syntactic references.
Douglas Gregor [Thu, 23 Sep 2010 23:01:17 +0000 (23:01 +0000)]
Synchronize globally-cached code completion results with the results
provided when the optimization is disabled. In particular, split
the completion context CCC_Other into two contexts: CCC_Other, which
means that it's an undisclosed context for which any other results are
unwelcome, and CCC_Recovery, which is used in recovery cases.
Since we're now using the completion context within the completion
results builder, make sure that it's always set to something.
For properties declared in a @protocol and redeclared in a class extension, use the class extension
as the lexical DeclContext for the @property declaration that gets auto-created for the @interface.
Fix bogus compiler errors when declaring anonymous union, outside a class, with
members with the same name as a decl outside the scope where the members are actually introduced.
Fixes http://llvm.org/PR6741
If -fcolor-diagnostics is explicitly passed to the driver respect that even if the driver is of the opinion that
stderr can't handle them. (see http://llvm.org/PR8150)
Patch by Frits van Bommel!
Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
Daniel Dunbar [Thu, 23 Sep 2010 01:54:28 +0000 (01:54 +0000)]
IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
directly. This makes a huge difference in the cleanliness of the IR after
optimization.
- I will trust, but verify, via future ABITest testing (for APCS-GNU, at
least).
-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556)
-Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect
on the layout or the size of the struct. Such structs may be mis-aligned for little benefit.
The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder.
To avoid calculating the layouts of all structs regardless of whether they are needed or not,
I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings
will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only:
$ cat t.c
struct S {
char c;
int i;
};
void f(struct S* s) {}
$ clang -fsyntax-only -Wpadded t.c
$ clang -c -Wpadded t.c -o t.o
t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded]
int i;
^
1 warning generated.
This is a good tradeoff between providing the warnings and not calculating layouts for all
structs in case the user has enabled a couple of rarely used warnings.
Correctly register the class extension as the lexical DeclContext for ObjC methods declared with @property in class extensions.
This matches the behavior for setters.
Also pass the class extension to ProcessPropertyDecl as the lexical DeclContext, even when not redeclaring the @property.
This fixes the remaining issues in <rdar://problem/7410145>.
For ObjCPropertyDecls in class extensions, use the class extension as the lexical DeclContext for newly created
ObjCMethodDecls. Further, use the location of the new property declaration as the location of new ObjCMethodDecls
(if they didn't previously exist).
This fixes more of the issues reported in <rdar://problem/7410145>.
Marcin Swiderski [Tue, 21 Sep 2010 05:58:15 +0000 (05:58 +0000)]
Added:
- definitions of interfaces for CFGInitializer and CFGAutomaticObjDtor,
- support for above classes to print_elem function (renamed print_stmt),
- support for VarDecls in StmtPrinterHelper.
Check for null ObjCInterfaceDecls returned from getClassInterface() when generating USRs. While I have no test case for this (could not create one), this shows up in crash reports. Tentatively fixes <rdar://problem/8452791>.
Bill Wendling [Tue, 21 Sep 2010 01:39:34 +0000 (01:39 +0000)]
Add a comment explaining why the MMX builtins are segregated and what we plan on
doing with them. It's a "FIXME" right now because this change hasn't been
implemented yet.
Douglas Gregor [Mon, 20 Sep 2010 23:34:21 +0000 (23:34 +0000)]
Refactor code completion for expressions that occur as arguments in
Objective-C message sends. There is no functionality change here; this
is prep work for using the parameter types to help guide the
expression results when code-completing the argument.
Douglas Gregor [Mon, 20 Sep 2010 23:11:55 +0000 (23:11 +0000)]
Code completion has no reason to prefer values over types, especially
at the statement level or in Objective-C message receivers. Therefore,
just give types and declarations the same basic priority, and adjust
from there.
Douglas Gregor [Mon, 20 Sep 2010 22:39:41 +0000 (22:39 +0000)]
Slight refactoring in code-completion results generation, placing the
various priority adjustments for preferences (based on selectors,
types) in a single function to make extension easier.
Douglas Gregor [Mon, 20 Sep 2010 21:25:19 +0000 (21:25 +0000)]
Get rid of the lame attempt to prioritize "void" functions at
statement context; it really isn't helpful in practice (remember
printf!) and we'll be doing other adjustments for statements very soon.
Douglas Gregor [Mon, 20 Sep 2010 21:11:48 +0000 (21:11 +0000)]
Tweak priorities for some types and macros:
- In Objective-C, we prefer BOOL to bool for historic reasons;
slightly penalize "bool".
- Treat Nil macro as a NULL pointer constant.
- Treat YES, NO, true, and false macros as constants.
- Treat the bool macro as a type.
Douglas Gregor [Mon, 20 Sep 2010 20:37:39 +0000 (20:37 +0000)]
Introduce a simple, substitution-based compression scheme for USRs, so
that redundant types don't result in super-long USRs. Fixes
<rdar://problem/8447875>.
Problem with gnu conditional extension with missing
LHS and when conditional expression is an array. Since
it will be decayed, saved expression must be saved with
decayed expression. This is necessary to preserve semantics
of this extension (and prevent an IRGen crash which expects
an array to always be decayed). I am sure there will be other
cases in c++ (aggregate conditionals for example) when saving of the
expression must happen after some transformation on conditional
expression has happened.
Doug, please review. Fixes // rdar://8446940
John McCall [Sat, 18 Sep 2010 05:25:11 +0000 (05:25 +0000)]
static local variables with destructors don't require a global destructor
unless we're on a platform without __cxa_atexit (or use thereof has been
disabled). This patch actually just disables the check completely for
static locals, but I've filed http://llvm.org/bugs/show_bug.cgi?id=8176 to
track the platform-specific fix.
John McCall [Sat, 18 Sep 2010 02:24:39 +0000 (02:24 +0000)]
Adjust a fixup's starting branch if it's being resolved because
it reached the outermost scope and it hasn't yet been forwarded
to a cleanup. Fixed PR8175.
Tom Care [Sat, 18 Sep 2010 00:06:34 +0000 (00:06 +0000)]
IdempotentOperationChecker no longer reports errors that are post-dominated by a sink. This fixes some false positives that were flagged because a path was incomplete (usually in a loop).
Douglas Gregor [Fri, 17 Sep 2010 22:25:06 +0000 (22:25 +0000)]
When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement.
The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given
x = p->y
if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.
David Chisnall [Fri, 17 Sep 2010 18:29:54 +0000 (18:29 +0000)]
Add a -ftrapv-handler= option which allows a handler to invoke instead of simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit.