summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/AnalysisContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Start migration of static analyzer to using theTed Kremenek2010-12-161-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit lvalue-to-rvalue casts that John McCall recently introduced. This causes a whole bunch of logic in the analyzer for handling lvalues to vanish. It does, however, raise a few issues in the analyzer w.r.t to modeling various constructs (e.g., field accesses to compound literals). The .c/.m analysis test cases that fail are due to a missing lvalue-to-rvalue cast that will get introduced into the AST. The .cpp failures were more than I could investigate in one go, and the patch was already getting huge. I have XFAILED some of these tests, and they should obviously be further investigated. Some highlights of this patch include: - CFG no longer requires an lvalue bit for CFGElements - StackFrameContext doesn't need an 'asLValue' flag - The "VisitLValue" path from GRExprEngine has been eliminated. Besides the test case failures (XFAILed), there are surely other bugs that are fallout from this change. llvm-svn: 121960
* Let StackFrameContext represent if the call expr is evaluated as lvalue.Zhongxing Xu2010-11-241-5/+6
| | | | | | This is required for supporting const reference to temporary objects. llvm-svn: 120093
* Added two new command line arguments:Marcin Swiderski2010-09-301-1/+6
| | | | | | | -cfg-add-implicit-dtors - sets CFG::BuildOptions::AddImplicitDtors for AnalysisCosumer to true, -cfg-add-initializers - sets CFG::BuildOptions::AddInitializers for AnalysisCosumer to true. llvm-svn: 115142
* Add CFG::BuildOptions class to pass in CFG builder options under on ↵Ted Kremenek2010-09-141-3/+7
| | | | | | parameter. Patch by Marcin Świderski! llvm-svn: 113898
* Delete the relaxedLiveness object in the dtor of AnalysisContext.Ted Kremenek2010-08-281-0/+1
| | | | llvm-svn: 112380
* Add alternate version of LiveVariables analysis that does not kill liveness ↵Tom Care2010-08-271-0/+14
| | | | | | | | | 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
* Several small changes to PseudoConstantAnalysis and the way ↵Tom Care2010-08-231-3/+3
| | | | | | | | | | | | IdempotentOperationChecker uses it. - Psuedo -> Pseudo (doh...) - C++ reference support - Added pseudoconstant test case for __block vars - Separated out static local checking from pseudoconstant analysis and generalized to non-local checking - Added missing test cases for storage false positives llvm-svn: 111832
* Added psuedo-constant analysis and integrated it into the false positive ↵Tom Care2010-08-181-0/+8
| | | | | | | | | | | | | reduction stage in IdempotentOperationChecker. - Renamed IdempotentOperationChecker::isConstant to isConstantOrPseudoConstant to better reflect the function - Changed IdempotentOperationChecker::PreVisitBinaryOperator to only run 'CanVary' once on undefined assumptions - Created new PsuedoConstantAnalysis class and added it to AnalysisContext - Changed IdempotentOperationChecker to exploit the new analysis - Updated tests with psuedo-constants - Added check to IdempotentOperationChecker to see if a Decl is const qualified llvm-svn: 111426
* Add -cc1 option '-unoptimized-cfg' to toggle using a CFG (for static ↵Ted Kremenek2010-08-031-1/+4
| | | | | | analysis) that doesn't prune CFG edges. llvm-svn: 110087
* Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to ↵Ted Kremenek2010-08-021-1/+13
| | | | | | | | the original CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)'). llvm-svn: 110085
* Make a bunch of new data structures for the new analysisZhongxing Xu2010-07-221-1/+1
| | | | | | | engine of the new translation unit. State marshal is there but no real work is done. End nodes are passed back. llvm-svn: 109105
* Reapply r108617.Zhongxing Xu2010-07-191-2/+3
| | | | llvm-svn: 108668
* Revert r108617, it broke the build.Benjamin Kramer2010-07-171-3/+2
| | | | llvm-svn: 108621
* Prepare the analyzer for the callee in another translation unit:Zhongxing Xu2010-07-171-2/+3
| | | | | | | Let AnalysisContext contain a TranslationUnit. Let CallEnter refer to an AnalysisContext instead of a FunctionDecl. llvm-svn: 108617
* Only perform CFG-based warnings on 'static inline' functions thatTed Kremenek2010-03-231-12/+16
| | | | | | | are called (transitively) by regular functions/blocks within a translation untion. llvm-svn: 99233
* When computing in AnalysisContext the variables referencedTed Kremenek2010-03-101-6/+20
| | | | | | by a block, also look at the contained blocks. llvm-svn: 98111
* Add a utility method.Zhongxing Xu2010-02-171-0/+12
| | | | llvm-svn: 96471
* Teach RegionStore::InvalidateRegions() to also invalidate static variables ↵Ted Kremenek2010-02-061-2/+20
| | | | | | referenced by blocks. llvm-svn: 95459
* Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek2010-01-251-23/+3
| | | | | | | | | | | | | | | | | | | | | | | | | (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
* Speed up compilation by avoiding generating exceptional edges fromMike Stump2010-01-211-1/+1
| | | | | | | | | | | | | CallExprs as those edges help cause a n^2 explosion in the number of destructor calls. Other consumers, such as static analysis, that would like to have more a more complete CFG can select the inclusion of those edges as CFG build time. This also fixes up the two compilation users of CFGs to be tolerant of having or not having those edges. All catch code is assumed be to live if we didn't generate the exceptional edges for CallExprs. llvm-svn: 94074
* Add infrastructure to add base initializers and member initializers toMike Stump2010-01-211-1/+1
| | | | | | the CFG. WIP. llvm-svn: 94062
* Add an unreachable code checker.Mike Stump2010-01-131-0/+4
| | | | llvm-svn: 93287
* As Ted suggested, record the callsite information with the StackFrameContext.Zhongxing Xu2009-12-241-3/+13
| | | | llvm-svn: 92121
* Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gaveJeffrey Yasskin2009-12-121-1/+1
| | | | | | no extra safety anyway. llvm-svn: 91207
* Enhance understanding of VarRegions referenced by a block whose declarations ↵Ted Kremenek2009-12-111-0/+13
| | | | | | are outside the current stack frame. Fixes <rdar://problem/7462324>. llvm-svn: 91107
* Add analysis support for blocks. This includes a few key changes:Ted Kremenek2009-12-071-0/+14
| | | | | | | | | | | | | | | | | - Refactor the MemRegion hierarchy to distinguish between different StackSpaceRegions for locals and parameters. - VarRegions for "captured" variables now have the BlockDataRegion as their super region (except those passed by reference) - Add transfer function support to GRExprEngine for BlockDeclRefExprs. This change also supports analyzing blocks as an analysis entry point (top-of-the-stack), which required pushing more context-sensitivity around in the MemRegion hierarchy via the use of LocationContext objects. Functionally almost everything is the same, except we track LocationContexts in a few more areas and StackSpaceRegions now refer to a StackFrameContext object. In the future we will need to modify MemRegionManager to allow multiple StackSpaceRegions in flight at once (for the analysis of multiple stack frames). llvm-svn: 90809
* Teach AnalysisContext::getBody() about BlockDecls.Ted Kremenek2009-12-041-0/+2
| | | | llvm-svn: 90585
* Allow BlockInvocationContext to wrap either a BlockDecl* or a ↵Ted Kremenek2009-12-041-3/+16
| | | | | | BlockDataRegion*, giving us choice in our degree of context-sensitivity. llvm-svn: 90516
* Refactor LocationContext creation logic into a single member template.Ted Kremenek2009-12-041-48/+50
| | | | llvm-svn: 90509
* Refactor FoldingSet profiling code for LocationContexts, and add a new ↵Ted Kremenek2009-12-041-8/+25
| | | | | | BlockInvocationContext to represent the invocation of a block. llvm-svn: 90506
* Enhance LiveVariables to understand that blocks can extend the liveness of a ↵Ted Kremenek2009-11-261-12/+75
| | | | | | | | | | | | | | | 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
* Add destructor and cleanup code to LocationContext (fixing some leaks). ↵Ted Kremenek2009-10-201-0/+21
| | | | | | | | | Along the way, have AnalysisManager periodically cleanup its AnalysisContextManager and LocationContextManager objects, as they don't need to forever retain all the CFGs ever created when analyzing a file. llvm-svn: 84684
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+9
| | | | llvm-svn: 81346
* Remove 'AnalysisContext::setDecl()', as we the Decl associated with anTed Kremenek2009-08-211-10/+13
| | | | | | | AnalysisContext should never change. Along the way, propagate some constness around. llvm-svn: 79701
* Constify LocationContext* (parent) and Stmt* fields in LocationContext.Ted Kremenek2009-08-211-6/+10
| | | | llvm-svn: 79700
* Remove 'SelfRegion' field from both BasicStoreManager and RegionStoreManager.Ted Kremenek2009-08-211-0/+7
| | | | | | | | | | | | | | | | | | SelfRegion represented the object bound to 'self' (when analyzing Objective-C methods) upon entry to a method. Having this region stored on the side ignores the current stack frame that we might be analyzing (among other things), and is a problem for interprocedural analysis. For RegionStoreManager, the value for SelfRegion is just lazily created. For BasicStoreManager, the value for SelfRegion is bound eagerly to 'self', but no explicit tracking of SelfRegion on the side is made. As part of this change, remove the restriction in BasicStoreManager that we only track ivars for 'self'. This shouldn't actually change anything in terms of precision, and simplifies the logic. llvm-svn: 79694
* add a bunch of routine methods to AnalysisContext.Zhongxing Xu2009-08-031-0/+50
| | | | llvm-svn: 77961
* Fix build warnings.Mike Stump2009-07-311-1/+2
| | | | llvm-svn: 77651
* This patch collects all analysis context data into a new class Zhongxing Xu2009-07-301-0/+73
AnalysisContext. llvm-svn: 77563
OpenPOWER on IntegriCloud