Ted Kremenek [Fri, 15 Feb 2008 22:29:00 +0000 (22:29 +0000)]
Added transfer function support for conditional branches with a NULL condition (e.g., "for(;;)").
Fixed bug in transfer function for compound assignment operators when both operands where variables but had a non-pointer type (we fired an assertion).
Ted Kremenek [Fri, 15 Feb 2008 22:09:30 +0000 (22:09 +0000)]
Simplified transfer function logic for ++/-- operators.
Added more boilerplate transfer function support for pointer arithmetic.
Added more pretty-printing support for symbolic constraints.
Added transfer function support for handling enum values.
Minor pointer types cleanup in ExplodedGraphImpl.
Eli Friedman [Fri, 15 Feb 2008 18:16:39 +0000 (18:16 +0000)]
Split out incomplete arrays from VariableArrayType into
IncompleteArrayType. This should make code dealing with both incomplete
and variable length arrays much more readable, plus it allows properly
making the distinction between isVariableArrayType() and
isVariablyModifiedType(). The patch is a little big, but it's
strightforward. so I don't think there should be any issues.
Ted Kremenek [Fri, 15 Feb 2008 00:35:38 +0000 (00:35 +0000)]
Added --grsimple-view option to clang driver; this is the same as
--grsimple except that it visualizes the ExplodedGraph using dot and
outputs the current function being analyzed. --grsimple is now silent
except when it emits diagnostics.
Ted Kremenek [Thu, 14 Feb 2008 23:25:54 +0000 (23:25 +0000)]
Added "symbol iterators" for RValues, allowing easy iteration over the symbols
referenced by an RValue, instead of having to query the type of the RValue.
Modified ValueState::RemoveDeadBindings to also prune dead symbols.
Ted Kremenek [Thu, 14 Feb 2008 22:13:12 +0000 (22:13 +0000)]
Partitioned definition/implementation of GRExperEngine into .h and .cpp.
Still some cleanup to do, but this initial checkin compiles and runs correctly.
Chris Lattner [Thu, 14 Feb 2008 19:27:54 +0000 (19:27 +0000)]
ParseCompoundStatementBody expects to only be called with { as the current
token. Diagnose when the { is missing in objc @try blocks instead of aborting.
Ted Kremenek [Thu, 14 Feb 2008 18:28:23 +0000 (18:28 +0000)]
Started partitioning of transfer function logic (and thus the policy behind
these operations) into GRTransferFuncs and its subclasses. Originally all
of this logic was handled by the class RValue, but in reality different
analyses will want more flexibility on how they evaluate different values.
Ted Kremenek [Wed, 13 Feb 2008 22:05:39 +0000 (22:05 +0000)]
When creating the CFGBlocks for a switch statement, we now have the "default"
branch ALWAYS be the last successor for a switch-terminated block. This allows
clients to distinguish cases like the following:
switch(...)
case XXX:
switch(...) {
case YYY: ...
}
case ZZZ: ..
}
In this case, the block with "case ZZZ:" is the default block for the inner
switch statement, but that case is associated with the outer switch statement,
and not the inner one. Clients can test for this behavior by checking if a
successor block is the last one (and thus just assume that this is the "default"
case).
Ted Kremenek [Wed, 13 Feb 2008 21:46:34 +0000 (21:46 +0000)]
Fixed bug in CFG construction when processing switch statements that contain no
"default" case. In such cases, we now correctly add the CFGBlock representing
the code after the switch statement as a successor to the block terminated by
the switch statement.
Ted Kremenek [Tue, 12 Feb 2008 21:37:25 +0000 (21:37 +0000)]
Minor (cosmetic) reshuffling of code. Fixed a bug in "Assume" logic when
handling Non-Lvalues of the type nonlval::SymbolVal; we were accidentally
casting them to lval::SymbolVal.
Ted Kremenek [Tue, 12 Feb 2008 18:08:17 +0000 (18:08 +0000)]
Added GRBlockCounter class, which tracks the number of times blocks
have been visited in a path. Added GRBlockCounter as an item to be
enqueued to the worklist.
Modified "ProcessBranch" in GRConstants to prune branches with symbolic
conditions that have been already taken.
Steve Naroff [Tue, 12 Feb 2008 04:08:59 +0000 (04:08 +0000)]
Allow the parser to detect invalid DeclSpec's. This fixes http://llvm.org/bugs/show_bug.cgi?id=1987.
This commit only "guards" the call to ParseDeclarationSpecifiers() in ParseDeclarationOrFunctionDefinition().
We could consider guarding all calls, however this is a bit radical (since it effectively stops parsing the declaration once we have a bad declspec). Will discuss with Chris tomorrow.
Ted Kremenek [Mon, 11 Feb 2008 23:12:59 +0000 (23:12 +0000)]
Consolidated use of BumpPtrAllocator shared by various ImmutableSet/ImmutableMap
factories.
Fixed a horrible bug in lval:DeclVar::classof(RValue* V); we weren't checking
V was an LValue, allowing nonlval::ConcereteInts to match isa<lval::DeclVar>.
Steve Naroff [Mon, 11 Feb 2008 22:29:58 +0000 (22:29 +0000)]
Move Microsoft __declspec hack from the parser to the preprocessor. Since we have no plans to actually implement this construct, it is cleaner to limit the change to the preprocessor.
Steve Naroff [Mon, 11 Feb 2008 21:52:37 +0000 (21:52 +0000)]
After yesterday's discussion (http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-February/001044.html), decided not to change the semantics of Type::isIncompleteType().
This commit simply changes a couple comments to reflect this decision.
Chris Lattner [Mon, 11 Feb 2008 00:02:17 +0000 (00:02 +0000)]
Fix PR1992 by computing the right type for string literals, which
is an array type not a pointer type. This requires updating some
diags that change and updating the code generator to handle the
proper form of strings.
Chris Lattner [Sun, 10 Feb 2008 23:08:00 +0000 (23:08 +0000)]
Fix PR1999, by emitting a hard error only if an argument declarator is completely
missing. Otherwise, it is an implicit int case, which is valid in c90 and invalid
elsewhere, but accepted as an extension.
Steve Naroff [Sun, 10 Feb 2008 00:30:18 +0000 (00:30 +0000)]
Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 submitted by Neil Booth.
Neil, can you point me to the place in the C99 spec that says this is allowed? I thought Expr::isLvalue() conformed to the spec, which says "C99 6.3.2.1: an lvalue is an expression with an object type or an incomplete type other than void.". Please advise.
Eli Friedman [Sat, 9 Feb 2008 08:50:58 +0000 (08:50 +0000)]
Expose the logic for field address codegen; it is needed for aggregate
initializers, and I don't want to duplicate the bitfield-handling code.
(I'll send a patch for aggregate initializers to the mailing
list sometime soon.)
Steve Naroff [Fri, 8 Feb 2008 22:06:17 +0000 (22:06 +0000)]
A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete
As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well).