Ted Kremenek [Wed, 16 Jan 2008 23:35:31 +0000 (23:35 +0000)]
Changed sorting criteria for DSPtr to put sub-expressions first in the value
map. This will allow us to quickly prune them from maps without searching the
entire map.
Chris Lattner [Wed, 16 Jan 2008 19:17:22 +0000 (19:17 +0000)]
Move promoteExprToType from being a static method in SemaExpr.cpp to being
a method named ImpCastExprToType in Sema.
Use this method to insert implicit casts for case statements from their
operand type to the condition type of the switch. This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.
Ted Kremenek [Wed, 16 Jan 2008 17:56:25 +0000 (17:56 +0000)]
More cleanups in DoStmt. The NodeSets are now vectors instead of sets, since
node caching in GREngine will guarantee that we do not insert a node twice into
a nodeset.
Ted Kremenek [Wed, 16 Jan 2008 00:53:15 +0000 (00:53 +0000)]
Renamed some internal classes for the GR-Constant Propagation analysis.
Cleaned up GRConstants::AddBinding to not directly reference the
predecessor node. Now we just manipulate the current state, and a driver
function creates nodes as needed.
Steve Naroff [Tue, 15 Jan 2008 22:21:49 +0000 (22:21 +0000)]
Finish up handling all permutations of "complex int" (in Sema::UsualArithmeticConversions()).
A FIXME remains to verify the conversion rules are consistent with GCC.
Steve Naroff [Tue, 15 Jan 2008 19:36:10 +0000 (19:36 +0000)]
- Change Type::isComplexType() to exlude GCC's complex integer extension. In general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec).
- Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType().
This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite).
Steve Naroff [Tue, 15 Jan 2008 01:41:59 +0000 (01:41 +0000)]
Rework commit r45976, which was incorrect.
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType().
- Don't inlude complex types with Type::isIntegerType(), which is too general.
- Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types.
Ted Kremenek [Tue, 15 Jan 2008 00:24:08 +0000 (00:24 +0000)]
Removed implicit transitions to a "BlockExit" location; we now handle
the end of the block by processing empty blocks (at BlockEntrance) or
when we have just processed the last statement in a block (at PostStmt).
Ted Kremenek [Mon, 14 Jan 2008 18:29:39 +0000 (18:29 +0000)]
When serializing CompoundLiteralExpr, serialize out the file scope flag before
serializing the subexpression (Init), as this results in a more efficient
encoding in the bitstream.
Steve Naroff [Mon, 14 Jan 2008 18:19:28 +0000 (18:19 +0000)]
Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
Chris Lattner [Mon, 14 Jan 2008 05:45:46 +0000 (05:45 +0000)]
Fix ASTContext::typesAreCompatible when analyzing a function type with
proto and function type without proto. It would never call
'functionTypesAreCompatible' because they have different type classes.
Steve Naroff [Sun, 13 Jan 2008 17:10:08 +0000 (17:10 +0000)]
Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below).
void
foo (void)
{
struct b;
struct b* x = 0;
struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type")
}
Ted Kremenek [Sun, 13 Jan 2008 04:56:13 +0000 (04:56 +0000)]
Created ExplodedGraph.cpp and moved most method implementations of
ExplodedNodeImpl::NodeGroup from being defined inline to being defined
"out-of-line" in ExplodedGraph.cpp. This removes a dependence on including
<vector> in ExplodedGraph.h, and will hopefully result in smaller generated code
with negligible performance impact.
Ted Kremenek [Sun, 13 Jan 2008 03:55:50 +0000 (03:55 +0000)]
Changed implementation of successor and predecessor sets for ExplodedNode
to optimize for the common case of having a single predecessor and a single
successor.
Chris Lattner [Sat, 12 Jan 2008 06:43:35 +0000 (06:43 +0000)]
When forming the squigly underline for a diagnostic, make sure to
verify that the source range corresponds to the current file, not
just the current line. This allows us to emit:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ^
instead of:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ~ ^
Ted Kremenek [Fri, 11 Jan 2008 00:40:29 +0000 (00:40 +0000)]
Renamed ProgramEdge to ProgramPoint and changed subclasses of ProgramEdge
to have a much simpler, cleaner interpretation of what is a "location"
in a function (as encoded by a CFG).
Steve Naroff [Thu, 10 Jan 2008 22:15:12 +0000 (22:15 +0000)]
- Teach Expr::isConstantExpr() about InitListExpr's (and offsetof, since I noticed it was missing).
- Rename CheckInitializer() to CheckInitializerTypes().
- Removed the isStatic argument to CheckInitializerTypes() and all of it's subroutines. Checking for constant expressions is now done separately.
- Added CheckForConstantInitializer().
Steve Naroff [Wed, 9 Jan 2008 23:34:55 +0000 (23:34 +0000)]
Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs).
Ted Kremenek [Wed, 9 Jan 2008 23:11:36 +0000 (23:11 +0000)]
Renamed various traits and classes. Added "Infeasible" bit to ExplodedNodeImpl
so that nodes can be marked as representing an infeasible program point. This
flag lets the path-sensitive solver know that no successors should be generated
for such nodes.
Ted Kremenek [Wed, 9 Jan 2008 22:52:38 +0000 (22:52 +0000)]
Renamed Stmt***Edge and ***StmtEdge (where *** = "Stmt" or "Blk") classes to
BExpr*** and ***BExpr respectively. These edges represent program locations
between the entrance/exit of a block and Block-level Expressions.
Also added ***SExpr and SExpr*** ProgramEdges to represent the locations in the
program between the evaluation of subexpressions and block-level expressions.
Steve Naroff [Wed, 9 Jan 2008 22:43:08 +0000 (22:43 +0000)]
Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...
Chris Lattner [Wed, 9 Jan 2008 18:59:34 +0000 (18:59 +0000)]
Fix isIntegerConstantExpr to compare against zero for casts to bool instead of
truncating. This allows us to compile:
void foo() {
static _Bool foo = 4;
}
into:
@foo1 = internal global i8 1
instead of:
@foo1 = internal global i8 4