summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
* When building StaticAnalyzer/Frontend add -I "<Checkers build dir>" to allow ↵Argyrios Kyrtzidis2011-02-173-1/+5
| | | | | | | | | | Checkers.inc to be included without '..', thus being compatible with build systems of *BSDs. Patch by Joerg Sonnenberger! llvm-svn: 125758
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-175-12/+23
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-172-5/+5
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* simplify a bit.Chris Lattner2011-02-172-4/+2
| | | | llvm-svn: 125724
* Makes most methods in SVals.h conform to the naming guide. ReviewedZhanyong Wan2011-02-1614-36/+34
| | | | | | by kremenek. llvm-svn: 125687
* Revert r125642. This broke the build? It should be a no-op.Nick Lewycky2011-02-161-1/+1
| | | | llvm-svn: 125645
* Don't use "../foo" to return to the current directory.Nick Lewycky2011-02-161-1/+1
| | | | llvm-svn: 125642
* [analyzer] AnalyzerFrontend is dependent on AnalyzerCheckers.Argyrios Kyrtzidis2011-02-161-1/+2
| | | | llvm-svn: 125637
* [analyzer] Use the new registration mechanism on the apple checkers:Argyrios Kyrtzidis2011-02-165-8/+38
| | | | | | | | | | NilArgChecker CFNumberCreateChecker NSAutoreleasePoolChecker CFRetainReleaseChecker ClassReleaseChecker llvm-svn: 125636
* [analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis2011-02-157-16/+28
| | | | | | | | | | | internal checkers: CastToStructChecker FixedAddressChecker PointerArithChecker PointerSubChecker llvm-svn: 125612
* [analyzer] Use the new registration mechanism on the IdempotentOperationChecker.Argyrios Kyrtzidis2011-02-154-9/+7
| | | | llvm-svn: 125611
* [analyzer] Remove ObjCSelfInitCheck from AnalyzerOptions.Argyrios Kyrtzidis2011-02-151-3/+0
| | | | llvm-svn: 125599
* [analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis2011-02-158-21/+65
| | | | | | | | | | | | | | | checks. These are: CStringChecker ChrootChecker MallocChecker PthreadLockChecker StreamChecker UnreachableCodeChecker MallocChecker creates implicit dependencies between checkers and needs to be handled differently. llvm-svn: 125598
* Add missing CMake dependencyDouglas Gregor2011-02-151-1/+1
| | | | llvm-svn: 125566
* Fix the clang-wpa example.Argyrios Kyrtzidis2011-02-153-3/+2
| | | | llvm-svn: 125565
* [analyzer] Reflect changes for tablegen'ing the checkers.Argyrios Kyrtzidis2011-02-153-13/+12
| | | | | | | -Update tablegen files for checkers, use the tablegen class name for the checker class name. -Update ClangSACheckersProvider to not look into hidden checker packages. llvm-svn: 125560
* [analyzer] Use the new registration mechanism on some of the internal ↵Argyrios Kyrtzidis2011-02-1510-23/+44
| | | | | | | | | | | | | checks. These are: StackAddrLeakChecker ObjCAtSyncChecker UnixAPIChecker MacOSXAPIChecker The rest have/create implicit dependencies between checkers and need to be handled differently. llvm-svn: 125559
* IdempotentOperationChecker: don't repeatedly recompute block reachability.Ted Kremenek2011-02-151-2/+3
| | | | llvm-svn: 125548
* Add current binary and source directories to the header search listOscar Fuentes2011-02-141-4/+0
| | | | | | for all compiler invocations. llvm-svn: 125514
* Remove left-over #include.Argyrios Kyrtzidis2011-02-141-2/+0
| | | | llvm-svn: 125507
* [analyzer] Overhauling of the checker registration mechanism.Argyrios Kyrtzidis2011-02-1415-1/+325
| | | | | | | | | | | | | | -Checkers will be defined in the tablegen file 'Checkers.td'. -Apart from checkers, we can define checker "packages" that will contain a collection of checkers. -Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g: Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker: -analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit -Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and register them with the CheckerManager which will be the entry point for all checker-related functionality. Currently only the self-initialization checker takes advantage of the new mechanism. llvm-svn: 125503
* [analyzer] Remove ManagerRegistry which is not used. In the future we may ↵Argyrios Kyrtzidis2011-02-144-41/+8
| | | | | | | | load analyzer plugins dynamically but registration through static constructors should be avoided. llvm-svn: 125502
* [analyzer] Move include/clang/StaticAnalyzer/AnalysisConsumer.h -> ↵Argyrios Kyrtzidis2011-02-143-2/+41
| | | | | | | | lib/StaticAnalyzer/Frontend/AnalysisConsumer.h since FrontendActions.cpp is the only user. llvm-svn: 125501
* [analyzer] Move Checkers/FrontendActions.cpp -> Frontend/FrontendActions.cppArgyrios Kyrtzidis2011-02-143-1/+1
| | | | llvm-svn: 125500
* [analyzer] Introduce libclangStaticAnalyzerFrontend and move ↵Argyrios Kyrtzidis2011-02-146-4/+31
| | | | | | Checkers/AnalysisConsumer.cpp into Frontend lib. llvm-svn: 125499
* Remove dead code in IdempotentOperationChecker.Ted Kremenek2011-02-141-46/+0
| | | | llvm-svn: 125497
* Fix edge case where we don't cull warnings in IdempotentOperationsChecker ↵Ted Kremenek2011-02-141-1/+6
| | | | | | due to incomplete analysis of loops. llvm-svn: 125495
* Use 'BitVector' instead of SmallPtrSet<CFGBlock*> in ↵Ted Kremenek2011-02-141-53/+68
| | | | | | IdempotentOperationsChecker. No real functionality change. llvm-svn: 125494
* Teach the IdempotentOperations checker to ignore property setters.Ted Kremenek2011-02-121-2/+9
| | | | llvm-svn: 125443
* Weaken the ObjCSelfInitChecker to only warn when one calls an 'init' method ↵Ted Kremenek2011-02-121-7/+22
| | | | | | within an 'init' method. This is a temporary stop gap to avoid false positives while we investigate how to make it smarter. llvm-svn: 125427
* static analyzer: Also invalidate instance variables of a receiver in a ↵Ted Kremenek2011-02-121-0/+12
| | | | | | | | message expression, just as we do with parameters. Fixes <rdar://problem/8725041>. llvm-svn: 125422
* Don't emit a dead store for '++' operations unless it occurs with a return ↵Ted Kremenek2011-02-121-6/+5
| | | | | | | | statement. We've never seen any other cases that were real bugs. Fixes <rdar://problem/6962292>. llvm-svn: 125419
* Add CMake dependencies so that LLVM_USED_LIBS order doesn't matter.Jeffrey Yasskin2011-02-111-0/+2
| | | | | | | I also sorted the tools/driver dependencies since their order no longer matters. llvm-svn: 125417
* Don't report dead stores on unreachable code paths. Fixes ↵Ted Kremenek2011-02-111-5/+61
| | | | | | <rdar://problem/8405222>. llvm-svn: 125415
* Remove RegionStoreManager::evalBinOp(), which is now handled by the SValBuilder.Ted Kremenek2011-02-111-119/+0
| | | | llvm-svn: 125396
* Rename 'InvalidateRegions()' to 'invalidateRegions()'.Ted Kremenek2011-02-119-30/+28
| | | | llvm-svn: 125395
* Allow the 'Eng' entry in GRStateManager to be a (possibly null) pointer ↵Ted Kremenek2011-02-111-9/+11
| | | | | | instead of a reference. llvm-svn: 125362
* CMake: LLVM_NO_RTTI must be obsolete now!NAKAMURA Takumi2011-02-102-4/+0
| | | | llvm-svn: 125275
* Run ~GRState() when reclaiming GRStates.Ted Kremenek2011-02-101-0/+1
| | | | llvm-svn: 125262
* static analyzer: Make GRStates reference counted, with reference counts ↵Ted Kremenek2011-02-101-0/+2
| | | | | | | | managed by ExplodedNodes. This reduces memory usage of the analyzer on sqlite by another 5%. llvm-svn: 125260
* Split 'include/clang/StaticAnalyzer' into ↵Ted Kremenek2011-02-1082-212/+212
| | | | | | | | 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'. This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries. llvm-svn: 125251
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-091-0/+1
| | | | llvm-svn: 125217
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | there were only three virtual methods of any significance. The primary way to grab child iterators now is with Stmt::child_range children(); Stmt::const_child_range children() const; where a child_range is just a std::pair of iterators suitable for being llvm::tie'd to some locals. I've left the old child_begin() and child_end() accessors in place, but it's probably a substantial penalty to grab the iterators individually now, since the switch-based dispatch is kindof inherently slower than vtable dispatch. Grabbing them together is probably a slight win over the status quo, although of course we could've achieved that with vtables, too. I also reclassified SwitchCase (correctly) as an abstract Stmt class, which (as the first such class that wasn't an Expr subclass) required some fiddling in a few places. There are somewhat gross metaprogramming hooks in place to ensure that new statements/expressions continue to implement getSourceRange() and children(). I had to work around a recent clang bug; dgregor actually fixed it already, but I didn't want to introduce a selfhosting dependency on ToT. llvm-svn: 125183
* static analyzer: Further reduce the analyzer's memory usage when analyzing ↵Ted Kremenek2011-02-094-4/+121
| | | | | | | | | | | | sqlite3 by 7-10% by recylcing "uninteresting" ExplodedNodes. The optimization involves eagerly pruning ExplodedNodes from the ExplodedGraph that contain practically no difference between the predecessor and successor nodes. For example, if the state is different between a predecessor and a node, the node is left in. Only for the 'environment' component of the state do we not care if the ExplodedNodes are different. This paves the way for future optimizations where we can reclaim the environment objects. llvm-svn: 125154
* analyzer, retain/release checker: Remove hack where objects passed in ↵Ted Kremenek2011-02-081-18/+0
| | | | | | message to 'self' are no longer tracked. llvm-svn: 125130
* [analyzer] Move the files in lib/StaticAnalyzer to lib/StaticAnalyzer/Core.Argyrios Kyrtzidis2011-02-0839-47/+64
| | | | | | | Eventually there will also be a lib/StaticAnalyzer/Frontend that will handle initialization and checker registration. Yet another library to avoid cyclic dependencies between Core and Checkers. llvm-svn: 125124
* [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.cpp -> ↵Argyrios Kyrtzidis2011-02-082-1/+1
| | | | | | lib/StaticAnalyzer/Checkers/ExperimentalChecks.cpp llvm-svn: 125123
* [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.h -> ↵Argyrios Kyrtzidis2011-02-0811-12/+12
| | | | | | lib/StaticAnalyzer/Checkers/ExperimentalChecks.h llvm-svn: 125122
* [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineInternalChecks.h -> ↵Argyrios Kyrtzidis2011-02-0832-32/+32
| | | | | | lib/StaticAnalyzer/Checkers/InternalChecks.h llvm-svn: 125121
* [analyzer] Fix a false positive of the 'self' initialization checker.Argyrios Kyrtzidis2011-02-051-4/+20
| | | | | | | | | | | | | | | | | | | A common pattern in classes with multiple initializers is to put the subclass's common initialization bits into a static function that receives the value of 'self', e.g: if (!(self = [super init])) return nil; if (!(self = _commonInit(self))) return nil; It was reported that 'self' was not set to the result of [super init]. Until we can use inter-procedural analysis, in such a call, transfer the ObjCSelfInitChecker flags associated with 'self' to the result of the call. Fixes rdar://8937441 & http://llvm.org/PR9094 llvm-svn: 124940
OpenPOWER on IntegriCloud