summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-1/+1
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Be a bit more consistent in using operator->Rafael Espindola2010-03-291-1/+1
| | | | | | | This patch moves some methods from QualType to Type and changes the users to use -> instead of . llvm-svn: 99805
* Simplify code a bit and remove unneeded semicolons.Benjamin Kramer2010-03-031-7/+4
| | | | llvm-svn: 97654
* [CFG]Ted Kremenek2010-03-021-17/+17
| | | | | | | | | | | | | | | | | | | After discussion with Zhongxing, don't force the initializer of DeclStmts to be block-level expressions. This led to some interesting fallout: [UninitializedValues] Always visit the initializer of DeclStmts (do not assume they are block-level expressions). [BasicStore] With initializers of DeclStmts no longer block-level expressions, this causes self-referencing initializers (e.g. 'int x = x') to no longer cause the initialized variable to be live before the DeclStmt. While this is correct, it caused BasicStore::RemoveDeadBindings() to prune off the values of these variables from the initial store (where they are set to uninitialized). The fix is to back-port some (and only some) of the lazy-binding logic from RegionStore to BasicStore. Now the default values of local variables are determined lazily as opposed to explicitly initialized. llvm-svn: 97591
* Always add CallExpr as block-level expression. Inline-based interproceduralZhongxing Xu2010-02-241-1/+1
| | | | | | analysis needs this. llvm-svn: 97014
* Revert "Simplify code: Succ is guaranteed to be not NULL.", which turns out toDaniel Dunbar2010-02-221-28/+28
| | | | | | not be guaranteed. llvm-svn: 96782
* Simplify code: Succ is guaranteed to be not NULL.Zhongxing Xu2010-02-221-28/+28
| | | | llvm-svn: 96772
* Improve unreachable code warnings with respect to dead binary andMike Stump2010-01-211-1/+2
| | | | | | unary operators. llvm-svn: 94084
* Speed up compilation by avoiding generating exceptional edges fromMike Stump2010-01-211-9/+35
| | | | | | | | | | | | | 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-4/+12
| | | | | | the CFG. WIP. llvm-svn: 94062
* Wire up the EH context for the catch clauses to the outer EH context. WIP.Mike Stump2010-01-201-9/+9
| | | | llvm-svn: 93963
* Add an exceptional edge from the try terminated block to the outer EHMike Stump2010-01-201-2/+16
| | | | | | | | context (try or the Exit block) when there isn't a catch (...). Improve CFG printing for catch (...). llvm-svn: 93962
* Add CFG support for the start and end of scopes and infrastructure forMike Stump2010-01-191-18/+76
| | | | | | implicit destructor calls. WIP. llvm-svn: 93922
* Tighten code and rework indentation of some if() branches (for readability). ↵Ted Kremenek2010-01-191-16/+15
| | | | | | No functionality change. llvm-svn: 93904
* Remove extra space in uses of 'assert()'.Ted Kremenek2010-01-191-7/+7
| | | | llvm-svn: 93903
* Re-alphabetize cases in switch statement.Ted Kremenek2010-01-191-9/+9
| | | | llvm-svn: 93902
* Add try/catch CFG support. Also improve throw CFG support. WIP.Mike Stump2010-01-191-10/+100
| | | | llvm-svn: 93840
* Add CFG support for the initializer of the condition variable of a ForStmt.Ted Kremenek2009-12-241-0/+13
| | | | llvm-svn: 92113
* CFG tweak: in a WhileStmt, the condition variable initializer is evaluated ↵Ted Kremenek2009-12-241-14/+13
| | | | | | every time the condition is checked. llvm-svn: 92111
* Add CFG support for the initializer of the condition variable of a WhileStmt.Ted Kremenek2009-12-241-1/+14
| | | | llvm-svn: 92105
* Add CFG support for the initializer of the condition variable of a SwitchStmt.Ted Kremenek2009-12-241-2/+13
| | | | llvm-svn: 92101
* Tidy up FindSubExprAssignments to not deference the child_iterator multiple ↵Ted Kremenek2009-12-231-7/+10
| | | | | | times. llvm-svn: 92087
* Add CFG support for the condition variable that can appear in IfStmts in C++ ↵Ted Kremenek2009-12-231-1/+13
| | | | | | | | mode. Add transfer function support in GRExprEngine for IfStmts with initialized condition variables. llvm-svn: 91987
* Add (initial?) static analyzer support for handling C++ references.Ted Kremenek2009-12-161-52/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change was a lot bigger than I originally anticipated; among other things it requires us storing more information in the CFG to record what block-level expressions need to be evaluated as lvalues. The big change is that CFGBlocks no longer contain Stmt*'s by CFGElements. Currently CFGElements just wrap Stmt*, but they also store a bit indicating whether the block-level expression should be evalauted as an lvalue. DeclStmts involving the initialization of a reference require us treating the initialization expression as an lvalue, even though that information isn't recorded in the AST. Conceptually this change isn't that complicated, but it required bubbling up the data through the CFGBuilder, to GRCoreEngine, and eventually to GRExprEngine. The addition of CFGElement is also useful for when we want to handle more control-flow constructs or other data we want to keep in the CFG that isn't represented well with just a block of statements. In GRExprEngine, this patch introduces logic for evaluating the lvalues of references, which currently retrieves the internal "pointer value" that the reference represents. EvalLoad does a two stage load to catch null dereferences involving an invalid reference (although this could possibly be caught earlier during the initialization of a reference). Symbols are currently symbolicated using the reference type, instead of a pointer type, and special handling is required creating ElementRegions that layer on SymbolicRegions (see the changes to RegionStoreManager). Along the way, the DeadStoresChecker also silences warnings involving dead stores to references. This was the original change I introduced (which I wrote test cases for) that I realized caused GRExprEngine to crash. llvm-svn: 91501
* Start the ball rolling on C++ support in the static analyzer. ForTed Kremenek2009-12-151-0/+2
| | | | | | | | now, don't construct CFGs that contain C++ try/catch statements, and have GRExprEngine abort a path if it encounters a C++ construct it doesn't understand (which is mostly everything at this point). llvm-svn: 91389
* Include BlockDeclRefExprs in constructed CFGs.Ted Kremenek2009-12-041-10/+0
| | | | llvm-svn: 90583
* Adapt to the DOTGraphTraits changes in LLVM.Tobias Grosser2009-11-301-2/+4
| | | | llvm-svn: 90137
* lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam2009-11-281-4/+3
| | | | llvm-svn: 90028
* Allow building of CFGs for ASTs that contain BlockExprs.Ted Kremenek2009-11-251-3/+6
| | | | llvm-svn: 89830
* Remove stale comment and tighten code.Ted Kremenek2009-10-201-6/+1
| | | | llvm-svn: 84697
* Use llvm::OwningPtr in CFGBuilder, fixing a leak on an error path.Ted Kremenek2009-10-201-12/+7
| | | | llvm-svn: 84695
* Use a BumpPtrAllocator to allocate all aspects of CFG, including CFGBlocks, ↵Ted Kremenek2009-10-121-63/+72
| | | | | | | | | | | | successor and predecessor vectors, etc. Speedup: when doing 'clang-cc -analyze -dump-cfg' (without actual printing, just CFG building) on the amalgamated SQLite source (all of SQLite in one source file), runtime reduced by 9%. This fixes: <rdar://problem/7250745> llvm-svn: 83899
* When building CFGs, no longer reverse the statements in the CFGBlock. InsteadTed Kremenek2009-09-241-16/+8
| | | | | | | | | have the iterators and operator[] handle the traversal of statements, as they are stored in reverse order. Tests show this has no real performance impact, but it does simply the CFG construction logic and will make it slightly easier to change the allocation strategy for CFGBlocks (as we have fewer copies). llvm-svn: 82702
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-97/+97
| | | | llvm-svn: 81346
* CFG construction: Abort CFG construction when processing a CompoundStmt if anyTed Kremenek2009-08-271-0/+3
| | | | | | of its subexpressions resulted in a "bad CFG". llvm-svn: 80298
* Don't try to evaluate an expression that is type- or value-dependent while ↵Douglas Gregor2009-08-241-1/+2
| | | | | | building the CFG llvm-svn: 79941
* Replace cerr with errs().Benjamin Kramer2009-08-231-5/+4
| | | | llvm-svn: 79854
* If the 'while' has an empty body, set the body to the continue target block.Zhongxing Xu2009-08-201-1/+1
| | | | | | | Although this does not make the CFG more correct, it makes the CFG more beautiful without multiple roots. llvm-svn: 79509
* If the body of for loop is empty, set its body to the continue target.Zhongxing Xu2009-08-201-1/+1
| | | | | | Otherwise we get a wrong CFG. llvm-svn: 79507
* Add noreturn as a type attribute, handle printing for them and handleMike Stump2009-07-251-16/+20
| | | | | | calls to noreturn function pointers when CFG building. llvm-svn: 77089
* Add doxygen comments and simplify expression.Ted Kremenek2009-07-241-1/+6
| | | | llvm-svn: 76955
* Introduce a new variant type 'TryResult' to represent the result ofTed Kremenek2009-07-241-106/+61
| | | | | | | | | | | TryEvaluateBool instead of using a raw 'int'. This avoids any confusion of how 'int' converts to bool, and makes the resultant code easier to read. Condense a bunch of 'addSuccessor()' calls in 'if ... else' to use the ternary operator instead. llvm-svn: 76947
* Refactor and push the evaluation as late as possible.Mike Stump2009-07-231-105/+54
| | | | llvm-svn: 76911
* Improve CFG support for C++ throw expressions.Mike Stump2009-07-221-0/+21
| | | | llvm-svn: 76814
* Make 'SaveAndRestore' and friends reusable classes in libAnalysis.Ted Kremenek2009-07-221-12/+1
| | | | llvm-svn: 76795
* Wire up CFG improvements for __builtin_choose_expr.Mike Stump2009-07-211-2/+20
| | | | llvm-svn: 76531
* Wire up CFG improvements for do { } while () when the condition is known.Mike Stump2009-07-211-7/+26
| | | | llvm-svn: 76530
* Wire up for statement CFG improvements for conditionals that are known.Mike Stump2009-07-211-10/+31
| | | | llvm-svn: 76529
* Wire up CFG improvements for while when the condition is known.Mike Stump2009-07-211-6/+26
| | | | llvm-svn: 76522
* Add yet more analysis for CFGs involving conditionals that are actually ↵Mike Stump2009-07-201-25/+99
| | | | | | constant. llvm-svn: 76500
OpenPOWER on IntegriCloud