Chris Lattner [Sat, 2 Feb 2008 04:51:41 +0000 (04:51 +0000)]
minor tweak to anders patch: (only) ocu vectors support splatting, but
ocu vectors should not treat bitcasts from int <-> vector as a splat
unless it is of the element type.
Chris Lattner [Sat, 2 Feb 2008 04:43:11 +0000 (04:43 +0000)]
fix codegen on static variables which have multiple decl nodes. These
should be merged just like normal globals. This fixes this testcase
that Anders provided:
static struct s a;
static struct s *ap1 = &a;
static struct s a = { 10 };
Steve Naroff [Sat, 2 Feb 2008 00:10:46 +0000 (00:10 +0000)]
Cleanup previous patch (based on feedback from Ted).
Since this behavior is useful for most classes, we might consider adding a simple 3 method class that implements the behavior. Ted said that Boost has such a class.
Ted Kremenek [Fri, 1 Feb 2008 21:28:59 +0000 (21:28 +0000)]
For ObjCAtCatchStmt, removed field 'NextAtCatchStmt' (which referenced the next @catch)
and put the the next ObjcAtCatchStmt* as part of SubExprs. This fixes a bug with
iterating over the children of ObjcAtCatch, where the next @catch was not
properly being iterated over as a child.
Altered serialization of ObjCAtCatchStmt to reflect this new layout of
its subexpressions, and fixed an ownership issue with the next @catch not
being serialized as an owned pointer.
Steve Naroff [Fri, 1 Feb 2008 20:02:07 +0000 (20:02 +0000)]
Fix two rewriter bugs with @catch.
- Support @catch(...), rather than crash:-)
- Make sure all catch bodies get rewritten. This "fix" is really a workaround until the iterator for the "try" AST is fixed. Will fix this in a separate commit.
Chris Lattner [Fri, 1 Feb 2008 06:57:39 +0000 (06:57 +0000)]
make some diagnostics more terse, update testcases.
Fix Sema::ActOnInstanceMessage to correctly do things in terms of canonical
types, fixing bogus errors like:
NSDistantObject.m:10383:120: error: bad receiver type 'typeof((id<NSMutableCopying>)self)'
id mess = ({ id __inv__ = ((void *)0); id __mb__ = _NSMessageBuilder((id <NSMutableCopying>)self, &__inv__); (void)[(__typeof__((id <NSMutableCopying>)self))__mb__ mutableCopyWithZone:((void *)0)]; if (!objc_collecting_enabled()) object_dispose(__mb__); __inv__; });
Chris Lattner [Fri, 1 Feb 2008 06:43:02 +0000 (06:43 +0000)]
Sema::ActOnInstanceMessage is generally doing bad things with typedefs, but
here I fix just one. The loop that rips through pointers should use
getAsPointerType() not static_cast<PointerType*> to get the pointee. This
fixes a crash on a large testcase.
Chris Lattner [Thu, 31 Jan 2008 19:42:41 +0000 (19:42 +0000)]
Add a new InsertText method that does the check to see if the insertion was valid. This
fixes crashes where the insertion point was in a macro. Instead of crashing, we want
to emit a warning.
Chris Lattner [Thu, 31 Jan 2008 06:10:07 +0000 (06:10 +0000)]
Fix PR1965: missing diagnostics for parameters that are missing
type specifiers. This required updating some (buggy) tests, and the
testcase was previously accidentally committed.
Chris Lattner [Thu, 31 Jan 2008 05:10:40 +0000 (05:10 +0000)]
Fix a rewriter crash when the whole body of a foreach is itself
rewritten, as in Sema/rewrite-foreach-6.m. Fariborz/Steve,
please review this to see if it is sane.
Ted Kremenek [Thu, 31 Jan 2008 02:35:41 +0000 (02:35 +0000)]
Added transfer function support for unary '&' and '*', providing basic
(local) aliasing support.
Modified ExplodedGraph pretty-printer (for GRConstants) to also print out the
pointer value of the state associated with a node. This way one can easily
see that two states are identical.
Steve Naroff [Thu, 31 Jan 2008 01:07:12 +0000 (01:07 +0000)]
Add support for CallExpr::isBuiltinConstantExpr(). For now, this hook is used to support CFConstantStrings. Can be extended to support other built-in functions.
This allows the following code to compile without error...
#include <CoreFoundation/CoreFoundation.h>
#define CONST_STRING_DECL(S, V) const CFStringRef S = (const CFStringRef)__builtin___CFStringMakeConstantString(V);
Ted Kremenek [Thu, 31 Jan 2008 00:09:56 +0000 (00:09 +0000)]
Added 'SymbolicLValue' class to represent LValues whose value is symbolic.
Improved pretty-printing of LValues.
Parameters whose values are pointers/references are now assigned SymbolicLValues.
Ted Kremenek [Wed, 30 Jan 2008 23:24:39 +0000 (23:24 +0000)]
We now delay adding nodes created by GRBranchNodeBuilder to the analysis
worklist until the dstor of GRBranchNodeBuilderImpl. This way clients can mark
creates nodes as "sinks" before they are added to the worklist.
Ted Kremenek [Wed, 30 Jan 2008 23:02:42 +0000 (23:02 +0000)]
Added method "printTerminator" to CFGBlock so that external clients can
pretty-print a block's terminator.
When building CFGs, for IfStmts ('if'), we no longer add the ParenExpr
that is the subexpression of the IfStmt to the CFG; instead we add its
first descendant subexpression that is not a ParenExpr.
Eli Friedman [Wed, 30 Jan 2008 17:02:03 +0000 (17:02 +0000)]
Fix codegen for conditionals with incommpatible pointer types. Code
that causes this isn't really correct, but if we're going to accept
this, it should come up with a consistent AST.
Chris Lattner [Wed, 30 Jan 2008 05:53:56 +0000 (05:53 +0000)]
Be more explicit about what flavors of initlistexpr's we can see. I don't
know if all of this is exactly right, but it seems like the right thing to
aim for. Steve, please review.
Eli Friedman [Wed, 30 Jan 2008 01:32:06 +0000 (01:32 +0000)]
Make sure to emit all the arguments to a function call. This fixes the
codegen of calls to functions without a prototype and varargs functions,
including printf.
Ted Kremenek [Tue, 29 Jan 2008 23:32:35 +0000 (23:32 +0000)]
Implemented more boilerplate in GREngine for processing branches. Now
we automatically generate a new successor node along an edge if the checker
did not explicitly do so (i.e., we just propagate the current state).
Ted Kremenek [Tue, 29 Jan 2008 21:21:30 +0000 (21:21 +0000)]
- Hooked up deserialization of ObjCAtSynchronizedStmt Stmt::Create().
- Some minor optimizations of the encoding format for ObjCAtSynchronizedStmt.
- Reordered methods so that the deserialization methods for
ObjCAtSynchronizedStmt appear in alphabetical order with the corresponding
methods of the other AST nodes.
Steve Naroff [Tue, 29 Jan 2008 18:58:14 +0000 (18:58 +0000)]
Tighten up ASTContext::typesAreCompatible()...it needs to make sure the qualifiers match. The comment and C99 citation for this routine were correct...the code needed to conform to the comment/spec. This fixes the test added below.
Tightening up this routine forced tweaks to Sema::CheckSubtractionOperands() and Sema::CheckCompareOperands(). For example, they both need to operate on the unqualified pointee...
Chris Lattner [Tue, 29 Jan 2008 07:54:23 +0000 (07:54 +0000)]
Fix a bug where we would incorrectly emit a "cannot paste" error
message when handling the GNU ", ## __VA_ARGS__" extension. While
I'm at it, flag uses of this as extensions.
Ted Kremenek [Tue, 29 Jan 2008 05:13:23 +0000 (05:13 +0000)]
Modified LiveVariables to perform all of its base initialization in the ctor,
and now we require a FunctionDecl* object so that we can also keep track of
all of the ParmDecls.
Modified clients of LiveVariables to conform to the new interface.
Steve Naroff [Tue, 29 Jan 2008 02:42:22 +0000 (02:42 +0000)]
Tweak Sema::DefaultArgumentPromotion() to call UsualUnaryConversions(). This makes sure function calls that don't have a prototype get the default function/array conversion.