aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis
AgeCommit message (Collapse)Author
2007-10-02ObjcCategoryDecl Does not subclass from ScopedDecl any more.Fariborz Jahanian
Ted may want to take a look at the change I made at FGRecStmtDeclVisitor.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42535 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02Moved ProgramEdge out out include/.../Analysis/PathSensitive to ↵Ted Kremenek
include/.../Analysis, as it is now used by the FlowSensitive subsystem as well. Removed "Edge" nested class by CFG, as it is now subsumed by ProgramEdge. Adjusted DataflowSolver and DataflowValues to use ProgramEdges instead of CFG::Edge. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42534 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02Added DenseMapInfo traits for ProgramEdgesTed Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-01Migrated LiveVariables and UninitializedVariables to now use theTed Kremenek
tracked BlkExpr information now maintained by the CFG class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-01Move ObjC decls to DeclObjC.h, a new AST header.Steve Naroff
Update clients and add to project file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Added ProgramEdge.h, which defines ProgramEdge (and subclasses) thatTed Kremenek
encapsulate a program point within a CFG for use by our path-sensitive dataflow solver. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42455 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Significant cleanups and bug-fixes to LiveVariables. Uses new refactoredTed Kremenek
ExprDeclBitVector class for defining dataflow state. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Refactored ExprDeclBitVector into two classes:Ted Kremenek
DeclBitVector ExprDeclBitVector (which subclasses the former) DeclBitVector is for analyses that just want to track bitvector state for declarations. ExprDeclBitVector is for analyses that want to track bitvector state for both both declarations and CFGBlock-level expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Fixed bug where declaration initializer expressions were notTed Kremenek
traversed by the visitor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42438 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Added iterator mechanism to iterator over the decls and expressionsTed Kremenek
tracked by an ExprDeclBitVector analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Fixed several bugs in the propagation of "uninitialized value"Ted Kremenek
taintness across expressions. Made "smart-culling" of taint propagation (for error reporting) correctly handle conditional expressions and a few other edge cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27Created new "ExprDeclBitVector" type bundle for dataflow analyses that need ↵Ted Kremenek
boolean values associated with ScopedDecls and CFGBlock-level Exprs. This is the common boilerplate needed by UninitializedValues and LiveVariables. Refactored UninitializedValues to use ExprDeclBitVector. Shortened the string diagnostic for UninitializedValues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26Added extra guard for null Stmt* when traversing the AST using VisitChildren.Ted Kremenek
Added assertion that Block-level statements should not be NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Moved "DataflowSolver.h" to the "include/" subtree. Adjusted clientTed Kremenek
code that uses the solver to reflect the new location. Created "FlowSensitive" subdirectory in include/clang/Analysis to hold header files relating to flow-sensitive analyses. Moved "DataflowValues.h" into this subdirectory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Further refactored DataflowSolver. Now most code for the solver is sharedTed Kremenek
between forward and backward analyses, with trait classes being used to implement the key differences in operations/functionality. Converted the LiveVariables analysis to use the generic DataflowSolver. This, along with removing some extra functionality that was not needed, reduced the code for LiveVariables by over half. Modified Driver code to handle the updated interface to LiveVariables. Modified the DeadStores checker to handle the update interface to LiveVariables. Updated DataflowValues (generic ADT to store dataflow values) to also store values for blocks. This is used by DeadStores. Updated some comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Added extra "constness" to parameter.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Added PersistentMap, an ADT that implements a map data structure thatTed Kremenek
is persistent. Adds/removals to a PersistentMap do not result in a map being modified, but a new map being created. This will be useful for path-sensitive analyses. The current implementation mainly makes copies to implement this functionality. If the map turns out to be extensively used, this implementation will be replaced with a more efficient one that uses data sharing (see comments in PersistentMap.h for more information). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42290 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24Added smart pointer class "IntrusiveSPtr" that handles referenceTed Kremenek
counted objects that maintain their own internal reference count. This smart pointer implementation is compatible with LLVM-style down-casting (see in llvm: include/llvm/Support/Casting.h). Implemented "RefCounted", a base class that objects that wish to be managed using IntrusiveSPtrs can subclass. Reference counted objects are being targeted for use in path-sensitive dataflow analyses where managing many live objects becomes difficult. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42260 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-23Fix for 64-bit systems.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42253 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20Renamed "include/clang/Analysis/CFGVisitors" "<snip>/Analysis/Visitors".Ted Kremenek
"Visitors" is more general than "CFGVisitors", as we aren't just using visitation useful for CFG analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42174 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20Moved include/clang/Analysis/*Visitor.h to include/clang/Analysis/CFGVisitors.Ted Kremenek
We had enough visitors that it was cluttering the Analysis directory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42173 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19More refactoring: decl and expr regisitration now uses CFGRecStmtDeclVisitor.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42145 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19Added two new visitors that extend CFGStmtVisitor: CFGRecStmtVisitor and ↵Ted Kremenek
CFGRecStmtDeclVisitor. The extended functionality of these visitors is that they automatically visit all statements in an AST (no explicit recursion is required from subclasses), and the for the latter, decls are visited as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42144 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18DataflowSolver now acccepts an "_Equal" template parameter that allows the userTed Kremenek
to specify how two dataflow values should be compared for equality. The default is to use std::equal_to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42115 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18Fixed bug where getBitRef would incorrectly grab the bit from theTed Kremenek
wrong bitvector. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42114 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18More refactoring and code reduction.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18Modified DataFlowValues and DataflowSolver to associate dataflow valueTed Kremenek
with CFG *edges* instead of blocks. This will fascilitate dataflow analyses that are sensitive to block terminators, and also simplifies some reasoning. Updated UninitializedValues to comply to this new interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42099 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17UninitialuzedValues now only tracks BlockVarDecls; obviating false positives ↵Ted Kremenek
with globals and function parameters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42055 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17More progress on UnitializedValues checker. We now have preliminary supportTed Kremenek
for reporting errors and running the checker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42046 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Split tracking of unitialized values for Decls and CFGBlock-level expressions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42041 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Removed "ObserverTy" from core DataflowValues types. The observerTed Kremenek
mechanism can be implemented simply by affixing the Observer to an analysis meta data, so it doesn't need to be a required type. This also permits analyses not to implement an Observer if it doesn't make sense. Changed "DataflowValues::MetaDataTy" to "DataflowValues::AnalysisDataTy" to reflect that the type enscapsulated the data associated with analyzing a given CFG. Changed CFGStmtVisitor::BlockStmt_VisitImplicitControlFlowStmt(Stmt*) to ...VisitImplicitControlFlowExpr(Expr*). The type narrowing is more precise and more useful to clients. Added CFGStmtVisitor::BlockStmt_VisitExpr to reflect the visitation of expressions at the block statement level. This captures all implicit control-flow statements as well as other expressions that are hoisted to the block level (such as conditions for terminators and function calls). This is especially useful for dataflow analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15switch the various CFG-based stuff over to using ASTConsumer interface,Chris Lattner
this eliminates their dependence on the preprocessor and eliminates some duplicated code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41993 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14Prototype implementation of new template-based dataflow solver.Ted Kremenek
Preliminary implementation of UninitializedValues, which is based on new solver (doesn't work yet, but compiles). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Fixed logic bug in recursion to visiting child statements.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41887 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Added extensions (subclasses) to the StmtVisitor class thatTed Kremenek
are useful for dataflow analysis: CFGStmtVisitor and DataflowStmtVisitor. CFGStmtVisitor is the same as StmtVisitor is that it has separate visitors for "root" statements in a CFGBlock (statements that have a designated slot int the list of statements in a CFGBlock). It also recognizes statements that have implicit control-flow, and calls special visitor methods for those. DataflowStmtVisitor extends CFGStmtVisitor to serve as a template for implementing transfer functions. It does a pre-/post-order traversal of substatements depending on whether we are doing a forward/backward analysis. It also has special handling for implicit-control-flow statements so that they are visited only once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10Fixed LiveVariables to no longer track the liveness of function pointersTed Kremenek
that refer to direct function calls. Modified interface of LiveVariables to only track liveness of VarDecls. This cleans up a bunch of edge cases, and removed the bug just mentioned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10Renaming of the LiveVariablesAuditor interface. Changed "Auditor" andTed Kremenek
"Audit" to "Observer" and "Observe" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Forgot to check in the actual "dead stores" checker in the last commit!Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Added "Dead Stores", a flow-sensitive checker that checks for storesTed Kremenek
to variables that are no longer live. This analysis is built on top of CFGs and the LiveVariables analysis. changes to driver: added driver option "-check-dead-stores" to run the analysis git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06LiveVariables:Ted Kremenek
- Finished 99% of analysis logic. Probably a few bugs. - Added querying functions to query liveness. - Added better pretty printing of liveness. - Added better bookkeeping of per-variable liveness information. - Added LiveVariablesAuditor interface, which allows "lazy" querying of intra-basic block liveness information. Driver: - Minor cleanups involved in dumping liveness information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41753 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Added an early implementation of Live-Variables analysis built onTed Kremenek
source-level CFGs. This code may change significantly in the near future as we explore different means to implement dataflow analyses. Added a driver option, -dump-live-variables, to view the output of live variable analysis. This output is very ALPHA; it will be improved shortly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41737 91177308-0d34-0410-b5e6-96231b3b80d8