aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/LiveVariables.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-1/+1
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-06-10[analyzer] PR8962 again. Ban ParenExprs (and friends) from block-level ↵Jordy Rose1-13/+3
expressions (by calling IgnoreParens before adding expressions to blocks). Undo 132769 (LiveVariables' local IgnoreParens), since it's no longer necessary. Also, have Environment stop looking through NoOp casts; it didn't match the behavior of LiveVariables. And once that's gone, the whole cast block of that switch is unnecessary. llvm-svn: 132840
2011-06-09[analyzer] Ignore parentheses around block-level expressions when computing ↵Jordy Rose1-3/+13
liveness. Fixes the other half of PR8962. llvm-svn: 132769
2011-02-11Don't report dead stores on unreachable code paths. Fixes ↵Ted Kremenek1-4/+8
<rdar://problem/8405222>. llvm-svn: 125415
2010-08-27Add alternate version of LiveVariables analysis that does not kill liveness ↵Tom Care1-6/+8
at assignments. This 'relaxed' liveness is useful in path sensitive analysis for situations where the resulting extended liveness allows us to find some bugs. - Added killAtAssign flag to LiveVariables - Added relaxed LiveVariables to AnalysisContext with an accessor llvm-svn: 112306
2010-08-25GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall1-5/+5
to the new constants. llvm-svn: 112047
2010-06-04Assignments to reference variables shouldn't kill the variable.Jordy Rose1-9/+13
llvm-svn: 105452
2010-03-03Fix an algorithmic bug in LiveVariables pointed out by Zhongxing.Ted Kremenek1-6/+9
If an initializer in a DeclStmt references the declared variable, that extends the liveness of that variable. llvm-svn: 97624
2010-03-02Register all parameters even if they didn't occur in the function body.Zhongxing Xu1-0/+6
We may query their liveness because they are added to store when passing argument values. llvm-svn: 97562
2010-01-25Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek1-1/+1
(1) libAnalysis is a generic analysis library that can be used by Sema. It defines the CFG, basic dataflow analysis primitives, and inexpensive flow-sensitive analyses (e.g. LiveVariables). (2) libChecker contains the guts of the static analyzer, incuding the path-sensitive analysis engine and domain-specific checks. Now any clients that want to use the frontend to build their own tools don't need to link in the entire static analyzer. This change exposes various obvious cleanups that can be made to the layout of files and headers in libChecker. More changes pending. :) This change also exposed a layering violation between AnalysisContext and MemRegion. BlockInvocationContext shouldn't explicitly know about BlockDataRegions. For now I've removed the BlockDataRegion* from BlockInvocationContext (removing context-sensitivity; although this wasn't used yet). We need to have a better way to extend BlockInvocationContext (and any LocationContext) to add context-sensitivty. llvm-svn: 94406
2009-12-30Simplify code by using an equivalent template class.Zhongxing Xu1-11/+2
llvm-svn: 92305
2009-12-24Enhance dataflow analyses to recognize branch statements in the CFG used as ↵Ted Kremenek1-1/+13
hooks for the initialization of condition variables. llvm-svn: 92119
2009-11-28lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam1-3/+2
llvm-svn: 90028
2009-11-26Enhance LiveVariables to understand that blocks can extend the liveness of a ↵Ted Kremenek1-3/+17
variable by "capturing" them in a BlockExpr. This required two changes: 1) Added 'getReferencedgetReferencedBlockVars()' to AnalysisContext so that clients can iterate over the "captured" variables in a block. 2) Modified LiveVariables to take an AnalysisContext& in its constructor and to call getReferencedgetReferencedBlockVars() when it processes a BlockExpr*. llvm-svn: 89924
2009-11-10Fix clang's use of DenseMap iterators after r86636 fixed their constness.Jeffrey Yasskin1-1/+1
Patch by Victor Zverovich! llvm-svn: 86638
2009-11-07Use SaveAndRestore to simplify logic in LiveVariables::runOnAllBlocks(). ↵Ted Kremenek1-3/+3
Patch by Kovarththanan Rajaratnam! llvm-svn: 86343
2009-11-06add some const qualifiers, patch by Kovarththanan Rajaratnam!Chris Lattner1-2/+2
llvm-svn: 86260
2009-10-18PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar1-1/+1
are updated. llvm-svn: 84447
2009-10-17Use raw_ostream instead of C stdio.Daniel Dunbar1-9/+6
llvm-svn: 84340
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump1-60/+60
llvm-svn: 81346
2009-07-16Move the source-level CFG from libAST to libAnalysis.Ted Kremenek1-1/+1
llvm-svn: 76092
2009-06-30Instead of r74522, use another approach to fix xfail_regionstore_wine_crash.c.Zhongxing Xu1-1/+0
Mark the super region of the binding of block level expr in the Environment as live. llvm-svn: 74525
2009-06-30Block level expr should be visited. Otherwise variables in init expr ofZhongxing Xu1-1/+3
DeclStmt would be dead before the DeclStmt. For example: int x = 0; int y = x; 'x' would be dead before 'int y = x'. llvm-svn: 74522
2009-04-07Remove hack from LiveVariables analysis where variables whose address are takenTed Kremenek1-18/+0
are considered 'live'. This hack isn't needed anymore because we have a separation in the path-sensitive analyzer between variable names and bindings; the analyzer can continue to reason about the storage of a variable after its name is no longer directly referenced. Now the live variables analysis literally means "is this name live". Along this line, update the dead stores checker to explicitly look for variables whose values have escaped. llvm-svn: 68504
2009-03-28rename some methods.Chris Lattner1-1/+1
llvm-svn: 67923
2009-01-30Fix horrible non-termination bug in LiveVariables. The issue was thatTed Kremenek1-2/+2
the liveness state of block-level expressions could oscillate because of two issues: - The initial value before a merge was not always set to "Top" - The set of live block-level expressions is a union, not an intersection This fixes <rdar://problem/650084>. llvm-svn: 63421
2009-01-27Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner1-7/+3
as reported to the user and as manipulated by #line. This is what __FILE__, __INCLUDE_LEVEL__, diagnostics and other things should follow (but not dependency generation!). This patch also includes several cleanups along the way: - SourceLocation now has a dump method, and several other places that did similar things now use it. - I cleaned up some code in AnalysisConsumer, but it should probably be simplified further now that NamedDecl is better. - TextDiagnosticPrinter is now simplified and cleaned up a bit. This patch is a prerequisite for #line, but does not actually provide any #line functionality. llvm-svn: 63098
2009-01-16Change some terminology in SourceLocation: instead of referring to Chris Lattner1-4/+4
the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
2008-12-09Fixed LiveVariables bug where we didn't consider block-level expressions ↵Ted Kremenek1-2/+12
that functioned as the size of a VLA to be live. llvm-svn: 60730
2008-11-14Minor tweaks to liveness analysis:Ted Kremenek1-0/+7
- Block-expression for 'ObjCForCollectionStmt' is not alive before it occurs - Recursively visit 'element' expression for ObjCForCollectionStmt to get liveness for referenced block-level expressions and variables. llvm-svn: 59316
2008-11-14Handle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt ↵Ted Kremenek1-5/+8
or DeclRefExpr. llvm-svn: 59290
2008-11-14Rename header file.Ted Kremenek1-2/+2
Update include files. llvm-svn: 59284
2008-11-13Fix uninitialized variable.Ted Kremenek1-1/+1
llvm-svn: 59222
2008-11-12Update CFGStmtVisitor to recognize that ObjCForCollectionStmts are special ↵Ted Kremenek1-2/+4
block-level "expressions". llvm-svn: 59176
2008-11-12Use Stmt* instead of Expr* for block-level expression.Ted Kremenek1-1/+1
llvm-svn: 59161
2008-11-11Accesses to a collection within a fast enumeration 'for' statement ↵Ted Kremenek1-9/+15
constitute a 'use'. llvm-svn: 59075
2008-11-11Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl1-1/+0
expressions, both of values and types. llvm-svn: 59057
2008-11-11Add transfer function support for ObjCForCollectionStmt to LiveVariables.Ted Kremenek1-1/+17
llvm-svn: 59053
2008-10-21Cosmetic patch from João Paulo Rechi VitaDouglas Gregor1-1/+0
llvm-svn: 57910
2008-09-26Move VLA processing logic from LiveVariables to CFG construction. This way ↵Ted Kremenek1-20/+0
all dataflow analyses "see" the VLA size expressions. llvm-svn: 56655
2008-09-26Examine VLA size expressions when computing liveness information.Ted Kremenek1-4/+26
Fixes <rdar://problem/6248086> llvm-svn: 56645
2008-08-05Added decl_iterator to DeclStmt to provide an abstract interface to iterate ↵Ted Kremenek1-2/+3
over the ScopedDecls of a DeclStmt. Updated a few clients of DeclStmt::getNextDeclarator() to use decl_iterator instead. Will update other clients after additional testing. llvm-svn: 54368
2008-07-03Fix a bug in the dead stores checker reported in the following email:Ted Kremenek1-3/+11
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html Essentially the observer mechanism in LiveVariables was observing block-level expressions multiple times, leading to a case where the dead store checker could see a value as dead when it was really live. llvm-svn: 53115
2008-06-17Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.Chris Lattner1-0/+5
Patch by David Chisnall! llvm-svn: 52422
2008-04-16Added CFGBlock::getTerminatorCondition() to get the Expr* of the condition a ↵Ted Kremenek1-48/+5
block's terminator. Refactored LiveVariables to use getTerminatorCondition() in VisitTerminator(). Bug fix: CFG now computes Block-level expression numbers using information from block terminators. This fixes <rdar://problem/5868189>. llvm-svn: 49818
2008-04-16LiveVariables now updates the liveness state of block-level expressions thatTed Kremenek1-12/+49
are referenced by CFGBlock terminators. llvm-svn: 49798
2008-04-15Fix bug in terminator processing for uninitialized-values: simply ignore the ↵Ted Kremenek1-7/+64
terminator, don't reprocess it. LiveVariables analysis now does a flow-insensitive analysis to determine what variables have their address taken; these variables are now always treated as being live. The DataflowSolver now uses "SetTopValue()" when getting the initial value for the entry/exit block. llvm-svn: 49734
2008-04-15Added initial support into the flow-sensitive dataflow solver to visit the ↵Ted Kremenek1-1/+19
Block-level expression in a block's terminator. This expression is visited within a block, but it is accessed by the terminator. This is important to observe because for live-variables analysis the block-level expression is live between the terminator and where the expression occurs in the block. So far this hasn't been an issue to not observe this because the block-level expression used in the terminator is always the last one in the block, and we have never queried the liveness information about this point (but before the terminator). llvm-svn: 49709
2008-04-15++/-- makes a variable live since it is used; thus the liveness state isTed Kremenek1-3/+3
"Alive" as opposed to staying the same. llvm-svn: 49707
2008-04-15Bug fix in LiveVariables: Operators ++/-- may kill a value, but the variableTed Kremenek1-6/+5
is still live. llvm-svn: 49705