aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LiveVariables.cpp
AgeCommit message (Collapse)Author
2012-08-14[analyzer] Teach live variable analyzes that super uses self pointer.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26[analyzer] Variables with destructors are live until the destructor is run.Jordan Rose
Test case in the next commit, which enables destructors under certain circumstances. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160805 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02Bail out the LiveVariables analysis when the CFG is very large, asTed Kremenek
we are encountering some scalability issues with memory usage. The appropriate long term fix is to make the analysis more scalable, but this will at least prevent the analyzer swapping when analyzing very large functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159578 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22Enhance AnalysisDeclContext::getReferencedBlockVars() to understand ↵Ted Kremenek
PseudoObjExprs. It turns out that the information collected by this method is a super set of the captured variables in BlockDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147122 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22Fix regression in LiveVariables when reasoning about variables captured by ↵Ted Kremenek
blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147116 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20Unweaken vtables as per ↵David Blaikie
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146959 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09We don't add ExprWithCleanups to the CFG, and getSVal looksJohn McCall
through it, so we should look through it for the live-values analysis as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06Change the AST representation of operations on Objective-CJohn McCall
property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05Tweak LookThroughStmt() in LiveVariables to properly look through ↵Ted Kremenek
alternativing ParenExprs and OpaqueValueExprs. Thanks to Anna and Argiris for iterating on this function. My original patch embarssingly didn't even pass the Clang tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05LookThroughStmt GM release.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05LookThroughStmt v4.6.3Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143795 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05Simplify LookThroughStmt in LiveVariables.cppArgyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143794 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05Another correction to the LiveVariables commit (r143767, r143780).Anna Zaks
Make test/Analysis/misc-ps.c test pass. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143790 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05Fix infinite loop in LiveVariables due to a misplaced 'break' (it would ↵Argyrios Kyrtzidis
break out of switch statement, not the while loop). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05Teach LiveVariables to look through OpaqueValueExprs for extending Stmt ↵Ted Kremenek
liveness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143767 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek
accurate, but it frees up the name AnalysisContext for other uses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22Pull TopologicallySortedCFG out of LiveVariables into its own analysis: ↵Ted Kremenek
PostOrderCFGView. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142713 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07Remove AnalysisContext::getLiveVariables(), and introduce a templatized ↵Ted Kremenek
mechanism to lazily create analyses that are attached to AnalysisContext objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06[static analyzer] Fix crash in LiveVariables and Environment::getSVal() when ↵Ted Kremenek
analyzing C++ pointer-to-member calls. Fixes <rdar://problem/10243398>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02Fix another major performance regression in LiveVariables by not ↵Ted Kremenek
canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges). Fixes <rdar://problem/10087538>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02Fix LiveVariables analysis bug with MaterializeTemporaryExpr and fix ↵Ted Kremenek
handling in ExprEngine. Fixes <rdar://problem/10201666>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16Fix massive LiveVariables regression (due to LiveVariables rewrite) by ↵Ted Kremenek
addressing two performance problems: - Speed of "merge()", which merged data flow facts. This was doing a set canonicalization on every insertion, which was super slow. To fix this, we use ImmutableSetRef. - Visit CFGBlocks in reverse postorder. This is a huge speedup, as on some test cases the algorithm would take many iterations to converge. This contains a bunch of copy-paste from UninitializedValues.cpp and ThreadSafety.cpp. The idea was to get something working first, and then refactor the common logic for all three files into a separate analysis/library entry point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-23Constify the result of CFGStmt::getStmt().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek
and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-06[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to ↵Ted Kremenek
avoid recursion to subexpression. This exposed bugs in the live variables analysis, and a latent analyzer bug in the SymbolReaper. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137006 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-02Make helper functions static.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136679 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28[analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek
be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs. The motivation of this large change is to drastically simplify the logic in ExprEngine going forward. Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings will be called frequently; this can also be improved over time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136419 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10[analyzer] PR8962 again. Ban ParenExprs (and friends) from block-level ↵Jordy Rose
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132840 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-09[analyzer] Ignore parentheses around block-level expressions when computing ↵Jordy Rose
liveness. Fixes the other half of PR8962. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132769 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11Don't report dead stores on unreachable code paths. Fixes ↵Ted Kremenek
<rdar://problem/8405222>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Add alternate version of LiveVariables analysis that does not kill liveness ↵Tom Care
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall
to the new constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04Assignments to reference variables shouldn't kill the variable.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-03Fix an algorithmic bug in LiveVariables pointed out by Zhongxing.Ted Kremenek
If an initializer in a DeclStmt references the declared variable, that extends the liveness of that variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02Register all parameters even if they didn't occur in the function body.Zhongxing Xu
We may query their liveness because they are added to store when passing argument values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97562 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek
(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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-30Simplify code by using an equivalent template class.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24Enhance dataflow analyses to recognize branch statements in the CFG used as ↵Ted Kremenek
hooks for the initialization of condition variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Enhance LiveVariables to understand that blocks can extend the liveness of a ↵Ted Kremenek
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*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10Fix clang's use of DenseMap iterators after r86636 fixed their constness.Jeffrey Yasskin
Patch by Victor Zverovich! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07Use SaveAndRestore to simplify logic in LiveVariables::runOnAllBlocks(). ↵Ted Kremenek
Patch by Kovarththanan Rajaratnam! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06add some const qualifiers, patch by Kovarththanan Rajaratnam!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar
are updated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17Use raw_ostream instead of C stdio.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16Move the source-level CFG from libAST to libAnalysis.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76092 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30Instead of r74522, use another approach to fix xfail_regionstore_wine_crash.c.Zhongxing Xu
Mark the super region of the binding of block level expr in the Environment as live. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30Block level expr should be visited. Otherwise variables in init expr ofZhongxing Xu
DeclStmt would be dead before the DeclStmt. For example: int x = 0; int y = x; 'x' would be dead before 'int y = x'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74522 91177308-0d34-0410-b5e6-96231b3b80d8