Daniel Dunbar [Wed, 25 Feb 2009 20:59:29 +0000 (20:59 +0000)]
Temporarily disable clearing of insert point (to indicate unreachable
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.
Douglas Gregor [Wed, 25 Feb 2009 19:37:18 +0000 (19:37 +0000)]
Implement parsing of nested-name-specifiers that involve template-ids, e.g.,
std::vector<int>::allocator_type
When we parse a template-id that names a type, it will become either a
template-id annotation (which is a parsed representation of a
template-id that has not yet been through semantic analysis) or a
typename annotation (where semantic analysis has resolved the
template-id to an actual type), depending on the context. We only
produce a type in contexts where we know that we only need type
information, e.g., in a type specifier. Otherwise, we create a
template-id annotation that can later be "upgraded" by transforming it
into a typename annotation when the parser needs a type. This occurs,
for example, when we've parsed "std::vector<int>" above and then see
the '::' after it. However, it means that when writing something like
this:
template<> class Outer::Inner<int> { ... };
We have two tokens to represent Outer::Inner<int>: one token for the
nested name specifier Outer::, and one template-id annotation token
for Inner<int>, which will be passed to semantic analysis to define
the class template specialization.
Most of the churn in the template tests in this patch come from an
improvement in our error recovery from ill-formed template-ids.
Daniel Dunbar [Wed, 25 Feb 2009 19:24:29 +0000 (19:24 +0000)]
Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
global variable) out of GenerateStaticBlockVarDecl.
- No intended functionality change.
- Prep for some mild cleanups and PR3662.
Douglas Gregor [Wed, 25 Feb 2009 16:33:18 +0000 (16:33 +0000)]
C99 DR #316 implies that the function parameter types that are known
only from a function definition (that does not have a prototype) are
only used to determine the compatible with other declarations of that
same function. In particular, when referencing the function we pretend
as if it does not have a prototype. Implement this behavior, which
fixes PR3626.
Chris Lattner [Wed, 25 Feb 2009 05:39:01 +0000 (05:39 +0000)]
Headers are basically done, debug info is just about done (and
will improve a lot this week hopefully), and a libgcc replacement
is ready once I wrangle lawyers.
Ted Kremenek [Tue, 24 Feb 2009 22:07:12 +0000 (22:07 +0000)]
ccc-analyzer: Don't analyze files with '-arch ppc' or '-arch ppc64' since Clang
doesn't support Altivec intrisics nor is it likely that we're currently
generating all the right #defines, etc., for those architectures.
Douglas Gregor [Tue, 24 Feb 2009 19:23:27 +0000 (19:23 +0000)]
Extend the implicit declaration and checking against out-of-scope
external declarations to also support external variable
declarations. Unified the code for these two cases into two new
subroutines.
Note that we fail to diagnose cases like the one Neil pointed
out, where a visible non-external declaration hides an external
declaration by the same name. That will require some reshuffling of
name lookup.
Ted Kremenek [Tue, 24 Feb 2009 19:15:11 +0000 (19:15 +0000)]
retain/release checker:
- For autorelease pool tracking, keep information about the stack of pools
separate from their contents. Also, keep track of the number of times an
autorelease pool will send the "release" message to an object when the pool is
destroyed.
- Update CFRefCount::Update to return a new state instead of a reference count
binding. This will allow us to implement more complicated semantics with
autorelease pools.
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).