summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Use BFS over call graph when analysing functions.Anna Zaks2012-03-131-22/+38
| | | | | | | | | | | BFS should give slightly better performance. Ex: Suppose, we have two roots R1 and R2. A callee function C is reachable through both. However, C is not inlined when analyzing R1 due to inline stack depth limit. With DFS, C will be analyzed as top level even though it would be analyzed as inlined through R2. On the other hand, BFS could avoid analyzing C as top level. llvm-svn: 152652
* [analyzer] Refactor CallGraph to use Recursive AST visitor whenAnna Zaks2012-03-131-6/+5
| | | | | | collecting function Decls. llvm-svn: 152651
* [analyzer] Use recursive AST visitor to drive simple visitation order inAnna Zaks2012-03-131-106/+95
| | | | | | | | | | | | | AnalysisConsumer. As a result: - We now analyze the C++ methods which are defined within the class body. These were completely skipped before. - Ensure that AST checkers are called on functions in the order they are defined in the Translation unit. llvm-svn: 152650
* [analyzer] Minor: factor out logic for determining if we should skip aAnna Zaks2012-03-131-4/+13
| | | | | | function. llvm-svn: 152649
* [analyzer] Move the check for parser errors out of the loop over Decls.Anna Zaks2012-03-131-5/+5
| | | | llvm-svn: 152648
* Add new analyzer diagnostic mode where plists can have bugs that span ↵Ted Kremenek2012-03-121-2/+15
| | | | | | multiple files. llvm-svn: 152586
* [analyzer] Include inlining call stack depth in plist output.Ted Kremenek2012-03-121-12/+24
| | | | llvm-svn: 152584
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-1113-28/+28
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* [analyzer] Replace a static helper with existing logic. No functionality change.Jordy Rose2012-03-111-26/+18
| | | | llvm-svn: 152521
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-103-13/+4
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [analyzer] fix regression in analyzer of NOT actually aborting on Stmts it ↵Ted Kremenek2012-03-104-13/+72
| | | | | | | | | | | doesn't understand. We registered as aborted, but didn't treat such cases as sinks in the ExplodedGraph. Along the way, add basic support for CXXCatchStmt, expanding the set of code we actually analyze (hopefully correctly). Fixes: <rdar://problem/10892489> llvm-svn: 152468
* Teach RetainCountChecker about mixing method families with explicit ↵Ted Kremenek2012-03-091-0/+30
| | | | | | annotations. Fixes <rdar://problem/10824732>. llvm-svn: 152448
* [analyzer] Add support for NoRedundancy inlining mode.Anna Zaks2012-03-093-32/+54
| | | | | | | | | | | We do not reanalyze a function, which has already been analyzed as an inlined callee. As per PRELIMINARY testing, this gives over 50% run time reduction on some benchmarks without decreasing of the number of bugs found. Turning the mode on by default. llvm-svn: 152440
* [analyzer] Implement basic path diagnostic pruning based on "interesting" ↵Ted Kremenek2012-03-0919-266/+230
| | | | | | | | | | | | | | | | | symbols and regions. Essentially, a bug centers around a story for various symbols and regions. We should only include the path diagnostic events that relate to those symbols and regions. The pruning is done by associating a set of interesting symbols and regions with a BugReporter, which can be modified at BugReport creation or by BugReporterVisitors. This patch reduces the diagnostics emitted in several of our test cases. I've vetted these as having desired behavior. The only regression is a missing null check diagnostic for the return value of realloc() in test/Analysis/malloc-plist.c. This will require some investigation to fix, and I have added a FIXME to the test case. llvm-svn: 152361
* [analyzer] Use call graph to determine order in which functions areAnna Zaks2012-03-081-7/+88
| | | | | | | | | | | | | | analyzed. The CallGraph is used when inlining is on, which is the current default. This alone does not bring any performance improvement. It's a stepping stone for the upcoming optimization in which we do not re-analyze a function that has already been analyzed while inlined in other functions. Using the call graph makes it easier to play with the order of functions to minimize redundant analyzes. llvm-svn: 152352
* [analyzer] Rework inlining related command line options.Anna Zaks2012-03-082-8/+15
| | | | | | | | | - Remove -analyzer-inline-call. - Add -analyzer-ipa=[none|inlining] - Add -analyzer-inlining-mode to allow experimentation for different performance tuning methods. llvm-svn: 152351
* Add a basic CallGraph to Analysis.Anna Zaks2012-03-082-0/+49
| | | | | | | | | | The final graph contains a single root node, which is a parent of all externally available functions(and 'main'). As well as a list of Parentless/Unreachable functions, which are either truly unreachable or are unreachable due to our analyses imprecision. The analyzer checkers debug.DumpCallGraph or debug.ViewGraph can be used to look at the produced graph. Currently, the graph is not very precise, for example, it entirely skips edges resulted from ObjC method calls. llvm-svn: 152272
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-1/+2
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.Ted Kremenek2012-03-063-31/+128
| | | | llvm-svn: 152139
* [analyzer] add a diagnostic event when entering a call via inlining, within ↵Ted Kremenek2012-03-063-5/+38
| | | | | | the callee, and add an edge. llvm-svn: 152086
* [analyzer] 'Looping back to the head of the loop' diagnostics are prunable.Ted Kremenek2012-03-061-0/+1
| | | | llvm-svn: 152083
* [analyzer] Remove now-unused constant. No functionality change.Jordy Rose2012-03-061-2/+0
| | | | llvm-svn: 152080
* [analyzer] Fix unnecessary dyn_cast_or_null. No functionality change.Jordy Rose2012-03-061-2/+2
| | | | llvm-svn: 152078
* Teak CallAndMessageChecker to only warn about uninitialized struct fields in ↵Ted Kremenek2012-03-051-2/+18
| | | | | | | | | | call arguments when the called function is never inlined. Fixes <rdar://problem/10977037>. llvm-svn: 152073
* Teach SimpleSValBuilder that (in the absence of more information) stack ↵Ted Kremenek2012-03-051-0/+18
| | | | | | memory doesn't alias symbolic memory. This is a heuristic/hack, but works well in practice. Fixes <rdar://problem/10978247>. llvm-svn: 152065
* [analyzer] Time the execution (per each TU) with -analyzer-stats.Anna Zaks2012-03-051-2/+18
| | | | llvm-svn: 152059
* [analyzer] False positive in SelfInit - teach the checker about methodAnna Zaks2012-03-051-10/+35
| | | | | | calls with self as a parameter. llvm-svn: 152039
* [analyzer] Malloc should assume that ownership is transfered whenAnna Zaks2012-03-051-1/+10
| | | | | | calling an ObjC method ending with 'NoCopy'. llvm-svn: 152037
* Remove a recursive visitation in ExprEngine that is no longer needed because ↵Erik Verbruggen2012-03-041-53/+15
| | | | | | the CFG is fully linearized. llvm-svn: 152007
* [analyzer] do not warn about returning stack-allocated memory when it comes ↵Ted Kremenek2012-03-031-10/+18
| | | | | | from an ancestor stack frame. llvm-svn: 151964
* [analyzer diagnostics] flush locations *before* popping the current path ↵Ted Kremenek2012-03-021-10/+11
| | | | | | | | when visiting a CallEnter. Fixes <rdar://problem/10967815> llvm-svn: 151938
* [analyzer] Bound the size of the functions being inlined + provideAnna Zaks2012-03-023-9/+20
| | | | | | | | | | | command line options for inlining tuning. This adds the option for stack depth bound as well as function size bound. + minor doxygenification llvm-svn: 151930
* [analyzer diagnostics] Change CompactPathDiagnostic to recursively compact ↵Ted Kremenek2012-03-022-20/+36
| | | | | | | | | | diagnostics in calls into macro pieces. Also fix handling of macros within calls in the HTMLDiagnostics. This also adds a test case for r151774. llvm-svn: 151872
* Teach the analyzer to just ignore CXXBindTemporaryExpr. There's nothing ↵Ted Kremenek2012-03-011-1/+1
| | | | | | special to do with it, since destructors are represented explicitly in the CFG. llvm-svn: 151856
* [analyzer] Fix a regression introduced in malloc withAnna Zaks2012-03-011-3/+7
| | | | | | | | | | attributes, introduced in r151188. + the test to catch it. Thanks to Ahmed Charles for pointing this out. llvm-svn: 151840
* Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.Argyrios Kyrtzidis2012-03-012-2/+2
| | | | | | Needs llvm update. llvm-svn: 151829
* [analyzer] Diagnostics - do not try to cleanup the path with macros, itAnna Zaks2012-03-011-3/+0
| | | | | | | will be done by the general cleanup later on. A Patch by Ted. llvm-svn: 151784
* Change if...else if...else if... to a switch.Ted Kremenek2012-03-011-19/+26
| | | | llvm-svn: 151775
* [analyzer] when scanning FIDs in a PathDiagnostic, correctly recurse calls ↵Ted Kremenek2012-02-292-24/+60
| | | | | | and macros. llvm-svn: 151774
* [analyzer] Malloc: A pointer might escape through CFContainers APIs,Anna Zaks2012-02-292-4/+44
| | | | | | | | | | | | funopen, setvbuf. Teach the checker and the engine about these APIs to resolve malloc false positives. As I am adding more of these APIs, it is clear that all this should be factored out into a separate callback (for example, region escapes). Malloc, KeyChainAPI and RetainRelease checkers could all use it. llvm-svn: 151737
* Remove a recursive visitiation in ExprEngine that is no longer neededErik Verbruggen2012-02-291-9/+3
| | | | | | because the CFG is fully linearized. llvm-svn: 151711
* [analyzer] Tweak the UnreachableCode checker to not warning about ↵Ted Kremenek2012-02-291-0/+8
| | | | | | unreachable default blocks. Patch by Cyril Roelandt! llvm-svn: 151709
* [analyzer diagnostics] Refactor filtration for PathDiagnosticConsumers that ↵Ted Kremenek2012-02-282-37/+45
| | | | | | | | don't support cross-file diagnostics into a common place. Currently enable this filtration for Plist diagnostics as well. llvm-svn: 151664
* [analyzer diagnostics] start prototyping stripping PathDiagnostics of ↵Ted Kremenek2012-02-282-0/+61
| | | | | | | | | unnecessary cruft caused by path inlining. This introduces a concept of a "prunable" PathDiagnosticEvent. Currently this is a flag, but we may evolve the concept to make this more dynamically inferred. llvm-svn: 151663
* [analyzer] Leaks should be uniqued by the allocation point in theAnna Zaks2012-02-281-4/+16
| | | | | | closest function context (RetainCountChecker). llvm-svn: 151661
* [analyzer] Retain release: drop the line number info from the leakAnna Zaks2012-02-281-3/+2
| | | | | | message. llvm-svn: 151657
* [analyzer] Stats: Add the stats about remove dead bindings, correct theAnna Zaks2012-02-281-0/+11
| | | | | | test. llvm-svn: 151656
* [analyzer] Leaks should be uniqued by the allocation point in theAnna Zaks2012-02-281-5/+12
| | | | | | closest function context (Keychain API). llvm-svn: 151613
* [analyzer] Fix Malloc False Positive (PR 12100)Anna Zaks2012-02-282-8/+29
| | | | | | | | When allocated buffer is passed to CF/NS..NoCopy functions, the ownership is transfered unless the deallocator argument is set to 'kCFAllocatorNull'. llvm-svn: 151608
* [analyzer] teach analyzer about ObjC literals, thus trimming out a false ↵Ted Kremenek2012-02-283-0/+23
| | | | | | | | | | positive with the malloc() checker involving comparing literal addresses to nil. Fixes <rdar://problem/10579586> llvm-svn: 151602
OpenPOWER on IntegriCloud