summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Change FunctionSummary.h's definition of SetOfDecls to be an ImmutableList ↵Ted Kremenek2012-04-271-8/+20
| | | | | | | | | | | | | instead of a mutable SmallPtrSet. While iterating over LocalTUDecls, there were cases where we could modify LocalTUDecls, which could result in invalidating an iterator and an analyzer crash. Along the way, switch some uses of std::queue to std::dequeue, which should be slightly more efficient. Unfortunately, this is a difficult case to create a test case for. llvm-svn: 155680
* Remove the unused, unmaintained, incomplete 'Index' library.Douglas Gregor2012-04-131-1/+0
| | | | llvm-svn: 154672
* [analyzer] PCH deserialization optimization.Anna Zaks2012-04-121-19/+67
| | | | | | | | | | | | | | | | We should not deserialize unused declarations from the PCH file. Achieve this by storing the top level declarations during parsing (HandleTopLevelDecl ASTConsumer callback) and analyzing/building a call graph only for those. Tested the patch on a sample ObjC file that uses PCH. With the patch, the analyzes is 17.5% faster and clang consumes 40% less memory. Got about 10% overall build/analyzes time decrease on a large Objective C project. A bit of CallGraph refactoring/cleanup as well.. llvm-svn: 154625
* [analyzer] Move stats calculation out of AnalysisConsumer destructor.Anna Zaks2012-04-051-7/+8
| | | | | | | The ASTConsumer does not get deleted with clang --analyze (for performance reasons), we still want the diagnostics to work. llvm-svn: 154078
* [analyzer] Record the basic blocks covered by the analyzes run.Anna Zaks2012-04-031-0/+10
| | | | | | | | Store this info inside the function summary generated for all analyzed functions. This is useful for coverage stats and can be helpful for analyzer state space search strategies. llvm-svn: 153923
* [analyzer] Do not inline functions which previously reached max blockAnna Zaks2012-03-301-1/+5
| | | | | | | | | | | | | | | count. This is an optimization for "retry without inlining" option. Here, if we failed to inline a function due to reaching the basic block max count, we are going to store this information and not try to inline it again in the translation unit. This can be viewed as a function summary. On sqlite, with this optimization, we are 30% faster then before and cover 10% more basic blocks (partially because the number of times we reach timeout is decreased by 20%). llvm-svn: 153730
* [analyzer] Enable retry exhausted without inlining by default.Anna Zaks2012-03-281-1/+1
| | | | llvm-svn: 153591
* [analyzer] Add an option to re-analyze a dead-end path without inlining.Anna Zaks2012-03-271-1/+2
| | | | | | | | | | | | | | | | | | | | | The analyzer gives up path exploration under certain conditions. For example, when the same basic block has been visited more than 4 times. With inlining turned on, this could lead to decrease in code coverage. Specifically, if we give up inside the inlined function, the rest of parent's basic blocks will not get analyzed. This commit introduces an option to enable re-run along the failed path, in which we do not inline the last inlined call site. This is done by enqueueing the node before the processing of the inlined call site with a special policy encoded in the state. The policy tells us not to inline the call site along the path. This lead to ~10% increase in the number of paths analyzed. Even though we expected a much greater coverage improvement. The option is turned off by default for now. llvm-svn: 153534
* [analyzer] Stats: Only count the number of times we run path sensitiveAnna Zaks2012-03-271-2/+3
| | | | | | | | analyzes. (This method can be called twice on the same function.) llvm-svn: 153531
* [analyzer] Change the order in which we analyze the functions underAnna Zaks2012-03-131-7/+11
| | | | | | | | | | | inlining to be the reverse of their declaration. This optimizes running time under inlining up to 20% since we do not re-analyze the utility functions which are usually defined first in the translation unit if they have already been analyzed while inlined into the root functions. llvm-svn: 152653
* [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
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-3/+3
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* [analyzer] Add support for NoRedundancy inlining mode.Anna Zaks2012-03-091-28/+42
| | | | | | | | | | | 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] 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-081-2/+4
| | | | | | | | | - Remove -analyzer-inline-call. - Add -analyzer-ipa=[none|inlining] - Add -analyzer-inlining-mode to allow experimentation for different performance tuning methods. llvm-svn: 152351
* [analyzer] Time the execution (per each TU) with -analyzer-stats.Anna Zaks2012-03-051-2/+18
| | | | llvm-svn: 152059
* [analyzer] Bound the size of the functions being inlined + provideAnna Zaks2012-03-021-1/+3
| | | | | | | | | | | 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] Add -analyzer-stats, which hooks up LLVM stats tracking.Anna Zaks2012-02-271-0/+3
| | | | | | As in http://llvm.org/docs/ProgrammersManual.html#Statistic llvm-svn: 151570
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-1/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-052-6/+6
| | | | llvm-svn: 149798
* Remove Diagnostic.h include from Preprocessor.h.Benjamin Kramer2012-02-041-0/+1
| | | | | | | - Move the offending methods out of line and fix transitive includers. - This required changing an enum in the PPCallback API into an unsigned. llvm-svn: 149782
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-2/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* [analyzer] Fix use-after-free in HandleTranslationUnit.Anna Zaks2012-01-071-6/+9
| | | | | | | | | | | | | A patch by Dmitri Gribenko! The attached patch fixes a use-after-free in AnalysisConsumer::HandleTranslationUnit. The problem is that BugReporter's destructor runs after AnalysisManager has been already deleted. The fix introduces a scope to force correct destruction order. A crash happens only when reports have been added in AnalysisConsumer::HandleTranslationUnit's BugReporter. We don't have such checkers in clang so no test. llvm-svn: 147732
* Fix cmake build with -DBUILD_SHARED_LIBS=ON.Rafael Espindola2011-12-291-1/+2
| | | | llvm-svn: 147338
* Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek2011-10-241-2/+2
| | | | | | accurate, but it frees up the name AnalysisContext for other uses. llvm-svn: 142782
* [analyzer] Remove LocationContext creation methods from AnalysisManager, and ↵Ted Kremenek2011-10-231-1/+2
| | | | | | | | change clients to use AnalysisContext instead. WIP to remove/reduce ExprEngine's usage of AnalysisManager. llvm-svn: 142739
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-1/+1
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Remove AnalysisContext::getLiveVariables(), and introduce a templatized ↵Ted Kremenek2011-10-071-3/+2
| | | | | | mechanism to lazily create analyses that are attached to AnalysisContext objects. llvm-svn: 141425
* [analyzer] Add -analyzer-purge option which can take on multiple values, ↵Anna Zaks2011-09-301-1/+1
| | | | | | remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.) llvm-svn: 140838
* Renaming PathDiagnosticClients.h to PathDiagnosticConsumers.h (issue 5397)David Blaikie2011-09-271-2/+2
| | | | llvm-svn: 140596
* Rename PathDiagnosticClient to PathDiagnosticConsumer as per issue 5397David Blaikie2011-09-261-10/+10
| | | | llvm-svn: 140492
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-253-7/+8
| | | | llvm-svn: 140478
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-1/+1
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* [analyzer] -analyze-function for ObjectiveC should check if any of the ↵Anna Zaks2011-09-101-1/+1
| | | | | | methods match the name (not only the first one). llvm-svn: 139439
* [analyzer] Remove TransferFuncs.h, then deal with the fallout.Jordy Rose2011-09-021-1/+0
| | | | | | And with that, TransferFuncs is gone! llvm-svn: 139003
* [analyzer] Move the knowledge of whether or not GC is enabled for the ↵Jordy Rose2011-09-021-39/+25
| | | | | | | | | | current analysis from CFRefCount to ExprEngine. Remove TransferFuncs from ExprEngine and AnalysisConsumer. Demote RetainReleaseChecker to a regular checker, and give it the name osx.cocoa.RetainCount (class name change coming shortly). Update tests accordingly. llvm-svn: 138998
* [analyzer] Pull body of loop in AnalysisConsumer::HandleDeclContext() into ↵Ted Kremenek2011-08-271-45/+52
| | | | | | its own method. No real functionality change. llvm-svn: 138712
* Fix typo.Jordy Rose2011-08-171-1/+1
| | | | llvm-svn: 137814
* [analyzer] Add a warning for an incompatible plugin version.Jordy Rose2011-08-171-6/+28
| | | | llvm-svn: 137813
* Silence compiler warnings by casting object pointers to function pointers ↵Benjamin Kramer2011-08-171-1/+2
| | | | | | | | via intptr_t. This is ugly but ISO C++ doesn't allow direct casts. llvm-svn: 137812
* [analyzer] Add basic support for pluggable checkers.Jordy Rose2011-08-171-11/+49
| | | | llvm-svn: 137802
* [analyzer] Overhaul of checker registration in preparation for basic plugin ↵Jordy Rose2011-08-164-30/+39
| | | | | | support. Removes support for checker groups (we can add them back in later if we decide they are still useful), and -analyzer-checker-help output is a little worse for the time being (no packages). llvm-svn: 137758
* Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek2011-08-121-7/+7
| | | | | | and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. llvm-svn: 137537
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-1/+1
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-233-9/+9
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
OpenPOWER on IntegriCloud