summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
Commit message (Collapse)AuthorAgeFilesLines
* Remove reference to AnalysisContext in Environment. We already have ↵Zhongxing Xu2010-03-055-26/+21
| | | | | | | | LocationContext information in ExplodedNode. llvm-svn: 97785
* When profiling Environment, also profile with AnalysisContext*, bacauseZhongxing Xu2010-03-043-0/+8
| | | | | | | | | | we now may have identical states with different analysis context. Set the right AnalysisContext in state when entering and leaving a callee. With both of the above changes, we can pass the test case. llvm-svn: 97724
* [CFG]Ted Kremenek2010-03-021-19/+29
| | | | | | | | | | | | | | | | | | | 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
* Don't conjure a symbol for DeclStmts when the variable is a C++ reference.Ted Kremenek2010-03-021-5/+5
| | | | llvm-svn: 97590
* Since now we store the cast type with an ElementRegion, there isZhongxing Xu2010-03-015-27/+17
| | | | | | no need to store a type with SymbolRegionValue. llvm-svn: 97437
* Assert when loading from a code text region instead of returning an unknown ↵Zhongxing Xu2010-03-011-1/+3
| | | | | | silently. llvm-svn: 97436
* Use getBody() to get the function definition when the decl referenced is notZhongxing Xu2010-02-281-1/+1
| | | | | | definition. llvm-svn: 97373
* Use a GDM to record the returned expression in the state when VisitReturnStmt.Zhongxing Xu2010-02-261-10/+28
| | | | | | | | | | | Use this information to find the returned value and bind it to CallExpr in ProcessCallExit. And there is no need to remove dead bindings in ProcessCallExit, because a. it would clean up the return value bound to CallExpr b. we still would do it in the next ProcessStmt(), where we would not misclean up the return value. llvm-svn: 97225
* Remove derelict GRStmtNodeBuilder::LastNode.Zhongxing Xu2010-02-262-5/+3
| | | | llvm-svn: 97207
* Restore Zhongxing's commits r97122 r97127 r97129 r97131 which were reverted ↵Douglas Gregor2010-02-253-74/+140
| | | | | | due to a Clang-on-Clang failure llvm-svn: 97162
* Revert patches r97122 r97127 r97129 r97131.Jakob Stoklund Olesen2010-02-253-140/+74
| | | | | | They were breaking clang-x86_64-darwin10-selfhost llvm-svn: 97138
* Move the GenerateCallExitNode logic completely into GREndPathNodeBuilder.Zhongxing Xu2010-02-252-16/+7
| | | | llvm-svn: 97131
* Move the dead bindings removal logic from CallInliner to ↵Zhongxing Xu2010-02-253-15/+19
| | | | | | GRExprEngine::ProcessCallExit(). llvm-svn: 97129
* Add comments.Zhongxing Xu2010-02-251-1/+3
| | | | llvm-svn: 97127
* Call inliner improvements:Zhongxing Xu2010-02-253-50/+119
| | | | | | | | | | | | | | This patch implements the CallEnter/CallExit idea of Ted. Add two interfaces to GRSubEngine: ProcessCallEnter, ProcessCallExit. The CallEnter program point uses caller's location context. The CallExit program point uses callee's location context. CallEnter is built by GRStmtNodeBuilder. CallExit is built by GREndPathNodeBuilder. llvm-svn: 97122
* Add MacOSXAPIChecker, a meta checker to include various precondition checks ↵Ted Kremenek2010-02-254-0/+144
| | | | | | | | | | | | for calls to various MacOS X functions. The checks in BasicObjCFoundationChecks.cpp will gradually be migrated here. As a first check, check that when 'dispatch_once()' is passed a predicate value that has non-local storage. llvm-svn: 97116
* When generating error node, check to see if we already cached out.Ted Kremenek2010-02-251-0/+3
| | | | llvm-svn: 97115
* Enhance the unused ivar checker to not consider an ivar to be accidentally ↵Ted Kremenek2010-02-252-16/+15
| | | | | | | | unused when it is explicitly marked as unused via __attribute__((unused)). llvm-svn: 97104
* Add UnixAPIChecker, a meta checker to include various precondition checks ↵Ted Kremenek2010-02-254-0/+154
| | | | | | | | | | | for calls to various unix/posix functions, e.g. 'open()'. As a first check, check that when 'open()' is passed 'O_CREAT' that it has a third argument. llvm-svn: 97086
* Remove stray #include.Ted Kremenek2010-02-251-1/+0
| | | | llvm-svn: 97085
* Remove #include.Ted Kremenek2010-02-251-1/+0
| | | | llvm-svn: 97084
* Divide list of registration functions in API and foundational checks. Also ↵Ted Kremenek2010-02-251-2/+6
| | | | | | trim whitespace. llvm-svn: 97083
* Sort list of checker registration functions.Ted Kremenek2010-02-251-12/+12
| | | | llvm-svn: 97082
* Dead emit dead store warnings when assigning nil to an ObjC objectTed Kremenek2010-02-231-1/+2
| | | | | | | pointer (for defensive programming). This matches the behavior with assigning NULL to a regular pointer. Fixes <rdar://problem/7631278>. llvm-svn: 96985
* Recognize attributes ns_returns_not_retained and cf_returns_not_retainedTed Kremenek2010-02-181-2/+16
| | | | | | in the static analyzer. llvm-svn: 96539
* Sort @includes.Ted Kremenek2010-02-181-11/+11
| | | | llvm-svn: 96537
* In symbol reaper, a variable is live if its stack frame is the parent of the Zhongxing Xu2010-02-172-4/+20
| | | | | | | | current stack frame. When leaving a callee, remove all bindings belonging to that callee. llvm-svn: 96473
* For inline-based inter-procedural analysis, we will have multiple stack ↵Zhongxing Xu2010-02-171-9/+16
| | | | | | space regions. Use a dense map to store them. llvm-svn: 96472
* Add simpler checker to check if variables captured by a block are uninitialized.Ted Kremenek2010-02-165-2/+123
| | | | llvm-svn: 96341
* Convert GRExprEngine's handling of ObjCMessageExprs to use a worklistTed Kremenek2010-02-151-202/+208
| | | | | | to evaluate arguments. llvm-svn: 96293
* clang::Attr objects should be treated as AST nodes as well byTed Kremenek2010-02-141-1/+5
| | | | | | the LLVMConventionsChecker. llvm-svn: 96202
* Add LLVM conventions check that scans for AST elements (types, stmts, decls)Ted Kremenek2010-02-141-13/+194
| | | | | | that allocate heap memory. llvm-svn: 96184
* Change LLVMConventionsChecker to accept an entire translation unit insteadTed Kremenek2010-02-141-4/+20
| | | | | | | | | | | | | | | | of operating on each code decl. This exposes two flaws in AnalysisConsumer that should eventually be fixed: (1) It is not possible to associate multiple "actions" with a single command line argument. This will require the notion of an "analysis" group, and possibly tablegen support. (although eventually we want to support dynamically loading analyses as well) (2) AnalysisConsumer may not actually be scanning the declarations in namespaces. We'll experiment first in LLVMConventionsChecker before changing the behavior in AnalysisConsumer. llvm-svn: 96183
* For the StringRef check, also visit the children of DeclStmts.Ted Kremenek2010-02-141-0/+3
| | | | llvm-svn: 96181
* Place type-checking static methods at type of file (where they will congregate).Ted Kremenek2010-02-141-33/+37
| | | | | | No functionality change. llvm-svn: 96180
* Fix pr6293. If ptr is NULL, no operation is preformed.Zhongxing Xu2010-02-141-0/+5
| | | | llvm-svn: 96154
* Add new static analyzer for checking LLVM coding conventions: ↵Ted Kremenek2010-02-142-0/+128
| | | | | | | | | | | | | -analyzer-check-llvm-conventions Currently these checks are intended to be largely syntactical, but may get more sophisticated over time. As an initial foray into this brave new world, emit a static analyzer warning when binding a temporary 'std::string' to an 'llvm::StringRef' where the lifetime of the 'std::string' does not outlive the 'llvm::StringRef'. llvm-svn: 96147
* Enhance RegionStore::InvalidateRegions() to correctly invalidate bindingsTed Kremenek2010-02-131-12/+32
| | | | | | by scanning through the values of LazyCompoundVals. llvm-svn: 96067
* Pull logic for visiting value bindings in InvalidateRegionsWorker into a ↵Ted Kremenek2010-02-131-20/+28
| | | | | | | | separate method. No functionality change. llvm-svn: 96060
* Eliminate the ASTContext parameter from RecordDecl::getDefinition()Douglas Gregor2010-02-113-3/+3
| | | | | | | and CXXRecordDecl::getDefinition(); it's totally unnecessary. No functionality change. llvm-svn: 95836
* Add comment.Zhongxing Xu2010-02-101-1/+2
| | | | llvm-svn: 95755
* Fix lookup of fields from lazy bindings to check if the region isTed Kremenek2010-02-091-9/+5
| | | | | | | | NULL, not the store, to determine if a lookup succeeded. The store can be null if it contained no bindings. This fixes a false positive reported to me by a user of the analyzer. llvm-svn: 95679
* Fix -Asserts warning.Daniel Dunbar2010-02-081-1/+3
| | | | llvm-svn: 95563
* Simplify another switch/strcmp construct. No functionality/performance change.Benjamin Kramer2010-02-081-55/+16
| | | | llvm-svn: 95561
* Reapply r95546, no intended change in performance or functionality.Benjamin Kramer2010-02-082-150/+75
| | | | llvm-svn: 95552
* Revert 95546 since it changed the algorithmic characteristics of the ↵Ted Kremenek2010-02-082-74/+151
| | | | | | convention lookup. llvm-svn: 95547
* Simplify code with StringRef.Benjamin Kramer2010-02-082-151/+74
| | | | | | 3 files changed, 76 insertions(+), 153 deletions(-) llvm-svn: 95546
* Revert 95541.Ted Kremenek2010-02-0828-128/+123
| | | | llvm-svn: 95545
* Rename: GRState::getSVal(Stmt*) => getExprVal(),Zhongxing Xu2010-02-0828-123/+128
| | | | | | GRState::getSVal(MemRegion*) => Load(). llvm-svn: 95541
* BindInternal is redundant. Remove it.Zhongxing Xu2010-02-081-14/+9
| | | | llvm-svn: 95540
OpenPOWER on IntegriCloud