Daniel Dunbar [Tue, 24 Feb 2009 07:47:38 +0000 (07:47 +0000)]
Some initial Obj-C zero cost EH support.
- Only handles cases with @try with no @catch blocks, and there are a
number of problems with the implementation. Nevertheless, this is
good enough to handled @synchronized correctly, and some other
basic uses.
Daniel Dunbar [Tue, 24 Feb 2009 07:42:32 +0000 (07:42 +0000)]
Add a very primitive clang based multifile 'delta'.
- Interface is more or less like multidelta.
- Keep in mind it won't work very well; delta is O(N^2) frequently in
practice. multidelta manages to work because it folds lines to keep
N small, but this is just working on raw tokens. However, I have a
fancy pants DAG based delta algorithm which will be the bees knees
once I get it wired to clang.
Douglas Gregor [Tue, 24 Feb 2009 04:26:15 +0000 (04:26 +0000)]
In C, when we see a function declaration within a local scope, export
that declaration to global scope so that it can be found from other
scopes. This allows us to diagnose redeclaration errors for external
declarations across scopes. We also warn when name lookup finds such
an out-of-scope declaration. This is part of <rdar://problem/6127293>;
we'll also need to do the same thing for variables.
Ted Kremenek [Tue, 24 Feb 2009 02:23:11 +0000 (02:23 +0000)]
Fix <rdar://problem/6611677>: Add basic transfer function support in the static
analyzer for array subscript expressions involving bases that are vectors. This
solution is probably a hack: it gets the lvalue of the vector instead of an
rvalue like all other types. This should be reviewed (big FIXME in
GRExprEngine).
Daniel Dunbar [Tue, 24 Feb 2009 01:43:46 +0000 (01:43 +0000)]
Fix two @synchronized bugs found by inspection: the expression to sychronize on should only be evaluated once, and it is evaluated outside the cleanup scope.
Also, lift SyncEnter and SyncExit up in nervous anticipation of x86-64
zero cost EH.
Ted Kremenek [Tue, 24 Feb 2009 01:26:56 +0000 (01:26 +0000)]
PTH: Cache *un-cleaned* spellings for literals instead of cleaned spellings.
This allows the PTH file to stay 100% in fidelity with the source code and
defines away some weird cosmetic bugs for operations such as '-E' where
maintaining knowledge of the original literal representation is useful.
Douglas Gregor [Tue, 24 Feb 2009 01:23:02 +0000 (01:23 +0000)]
Improve merging of function declarations. Specifically:
- When we are declaring a function in local scope, we can merge with
a visible declaration from an outer scope if that declaration
refers to an entity with linkage. This behavior now works in C++
and properly ignores entities without linkage.
- Diagnose the use of "static" on a function declaration in local
scope.
- Diagnose the declaration of a static function after a non-static
declaration of the same function.
- Propagate the storage specifier to a function declaration from a
prior declaration (PR3425)
- Don't name-mangle "main"
Ted Kremenek [Tue, 24 Feb 2009 00:30:21 +0000 (00:30 +0000)]
PTH: When emitting tokens for literals with cached spellings, change the token
size to that of the *cleaned* spelling. This way 'getSpelling()' for literals in
the Preprocessor just works and doesn't read beyond the bounds of the cached
spelling buffer.
Ted Kremenek [Mon, 23 Feb 2009 22:44:26 +0000 (22:44 +0000)]
Tidy up the path diagnostic generation logic in BugReporter and remove a case where an "Execution continues..." diagnostic could result in an empty message bubble.
Chris Lattner [Mon, 23 Feb 2009 22:00:08 +0000 (22:00 +0000)]
fix rdar://6611778, a redefinition of an interface was causing an
assertion when the ivars and method list was reset into the existing
interface. To fix this, mark decls as invalid when they are redefined,
and don't insert ivars/methods into invalid decls.
Ted Kremenek [Mon, 23 Feb 2009 17:45:03 +0000 (17:45 +0000)]
Add more boilerplate logic to more accurately reason about autorelease pools.
This doesn't change the current functionality, but better codifies the
autorelease pool stack itself.
Steve Naroff [Mon, 23 Feb 2009 15:40:48 +0000 (15:40 +0000)]
Remove isSuperExpr(), which ignores any casts on 'super'.
I don't think casting super makes any sense (since it won't effect method lookup).
Will discuss with other offline and decide what to do.
Steve Naroff [Sun, 22 Feb 2009 19:35:57 +0000 (19:35 +0000)]
Contains the following (related to problems found while investigting <rdar://problem/6497631> Message lookup is sometimes different than gcc's).
- Implement instance/class overloading in ObjCContainerDecl (removing a FIXME). This involved hacking NamedDecl::declarationReplaces(), which took awhile to figure out (didn't realize replace was the default).
- Changed Sema::ActOnInstanceMessage() to remove redundant warnings when dealing with protocols. For now, I've omitted the "protocol" term in the diagnostic. It simplifies the code flow and wan't always 100% accurate (e.g. "Foo<Prot>" looks in the class interface, not just the protocol).
- Changed several test cases to jive with the above changes.
Eli Friedman [Sun, 22 Feb 2009 06:45:27 +0000 (06:45 +0000)]
Throw the switch to exclusively use Evaluate (along with the small
helper isConstantInitializer) to check whether an initializer is
constant. This passes tests, but it's possible that it'll cause
regressions with real-world code.
Future work:
1. The diagnostics obtained this way are lower quality at the moment;
some work both here and in Evaluate is needed for accurate diagnostics.
2. We probably need some extra code when we're in -pedantic mode so we
can strictly enforce the rules in C99 6.6p7.
3. Dead code cleanup (this should wait until after 2, because we might
want to re-use some of the code).
Daniel Dunbar [Sun, 22 Feb 2009 04:17:53 +0000 (04:17 +0000)]
ABITestGen: Use explicit list of vector types instead of just a list
of sizes. Turns out we don't care very much about vector types that
don't map to the hardware.
Eli Friedman [Sun, 22 Feb 2009 04:02:33 +0000 (04:02 +0000)]
Enhance Evaluate to handle ObjC qualified id and class types; as far as
I know, these follow the exact same rules as pointers, so I just made
them use the same codepath. Someone more familiar with ObjC should
double-check this, though.
Eli Friedman [Sun, 22 Feb 2009 03:23:43 +0000 (03:23 +0000)]
Last part of PR3254: use the same alignment computation in Sema and
CodeGen. I'm not sure whether this actually makes any visible
difference, but it's better to be consistent anyway.
Eli Friedman [Sun, 22 Feb 2009 00:20:44 +0000 (00:20 +0000)]
Sanity fix for PR3642: if we're treating a diagnostic as an error, it's
required to actually be an error for correctness. The attached testcase
now gives an error instead of mysteriously crashing.
Now, it's possible we actually want to support the given usage, but I
haven't looked at the relevant code closely.
Cedric Venet [Sat, 21 Feb 2009 17:14:49 +0000 (17:14 +0000)]
Fix build on windows.
Should clang have a config.h or should we use the config.h of llvm or using the preprocessor is OK? I did a quick fix here, but having a guideline on how to handle non portable function would be great (or ask ted to stop breaking the windows build :)).
Steve Naroff [Sat, 21 Feb 2009 17:03:43 +0000 (17:03 +0000)]
Add test case to record a couple inconsistencies with GCC (found in <rdar://problem/6561076> [clang on Xcode] warning: cannot find protocol definition for 'OzzyP').
Removing the "cannot find protocol" warning is trivial if necessary (but I don't think it's the right thing to do).
Steve Naroff [Sat, 21 Feb 2009 16:18:07 +0000 (16:18 +0000)]
This fixes <rdar://problem/6497650> More type mismatches issues with clang.
Move two key ObjC typechecks from Sema::CheckPointerTypesForAssignment() to ASTContext::mergeTypes().
This allows us to take advantage of the recursion in ASTContext::mergeTypes(), removing some bogus warnings.
This test case I've added includes an example where we still warn (and GCC doesn't). Need to talk with folks and decide what to do. At this point, the major bogosities should be fixed.
Ted Kremenek [Sat, 21 Feb 2009 05:13:43 +0000 (05:13 +0000)]
Improved naming convention heuristics in the retain/release checker to better
handle method names that contain 'new', 'copy', etc., but those words might be
the substring of larger words such as 'newsgroup' and 'photocopy' that do not
indicate the allocation of objects. This should address the issues discussed in
<rdar://problem/6552389>.
Daniel Dunbar [Fri, 20 Feb 2009 23:09:27 +0000 (23:09 +0000)]
We must always mangle attribute overloadable functions; even if in a
system header.
- Prevents a codegen crash when anything used anything in tgmath! :)
Chris Lattner [Fri, 20 Feb 2009 22:46:43 +0000 (22:46 +0000)]
switch the macroinfo argument lists from being allocated off the heap
to being allocated from the same bumpptr that the MacroInfo objects
themselves are.
This speeds up -Eonly cocoa.h pth by ~4%, fsyntax-only is barely measurable.
Chris Lattner [Fri, 20 Feb 2009 21:44:01 +0000 (21:44 +0000)]
allocate and dellocate objc decl list through AST Context instead of
with new/delete. With disable-free, this reduces the number of 4/8 byte
mallocs from 4793/1541 to 865/456 and also drops other sizes as well.