Commit Graph

67 Commits

Author SHA1 Message Date
Anna Zaks 394d07ea88 [analyzer] Add support for NoRedundancy inlining mode.
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
2012-03-09 21:14:01 +00:00
Anna Zaks eee9110721 [analyzer] Use call graph to determine order in which functions are
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
2012-03-08 23:16:38 +00:00
Anna Zaks 0af3e06ff6 [analyzer] Rework inlining related command line options.
- Remove -analyzer-inline-call.
 - Add -analyzer-ipa=[none|inlining]
 - Add -analyzer-inlining-mode to allow experimentation for
different performance tuning methods.

llvm-svn: 152351
2012-03-08 23:16:35 +00:00
Anna Zaks 9bd4be9657 [analyzer] Time the execution (per each TU) with -analyzer-stats.
llvm-svn: 152059
2012-03-05 20:53:59 +00:00
Anna Zaks 265087721a [analyzer] Bound the size of the functions being inlined + provide
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
2012-03-02 19:05:03 +00:00
Anna Zaks b028654031 [analyzer] Add -analyzer-stats, which hooks up LLVM stats tracking.
As in http://llvm.org/docs/ProgrammersManual.html#Statistic

llvm-svn: 151570
2012-02-27 21:33:16 +00:00
Benjamin Kramer 7ec12c928a Revert my patches which removed Diagnostic.h includes by moving some 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
2012-02-07 22:29:24 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Benjamin Kramer 02c746de10 Remove Diagnostic.h include from Preprocessor.h.
- 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
2012-02-04 13:02:15 +00:00
David Blaikie f47fa304a4 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Anna Zaks 17f57b0a00 [analyzer] Fix use-after-free in HandleTranslationUnit.
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
2012-01-07 16:49:46 +00:00
Rafael Espindola d1c9c9bbfd Fix cmake build with -DBUILD_SHARED_LIBS=ON.
llvm-svn: 147338
2011-12-29 04:31:59 +00:00
Ted Kremenek 81ce1c8a99 Rename AnalysisContext to AnalysisDeclContext. Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.
llvm-svn: 142782
2011-10-24 01:32:45 +00:00
Ted Kremenek 142adc492b [analyzer] Remove LocationContext creation methods from AnalysisManager, and change clients to use AnalysisContext instead.
WIP to remove/reduce ExprEngine's usage of AnalysisManager.

llvm-svn: 142739
2011-10-23 02:31:52 +00:00
Benjamin Kramer b89514a9b8 Change operator<< for raw_ostream and NamedDecl to take a reference instead of a pointer.
Passing a pointer was a bad idea as it collides with the overload for void*.

llvm-svn: 141971
2011-10-14 18:45:37 +00:00
Ted Kremenek dccc2b2277 Remove AnalysisContext::getLiveVariables(), and introduce a templatized mechanism to lazily create analyses that are attached to AnalysisContext objects.
llvm-svn: 141425
2011-10-07 22:21:02 +00:00
Anna Zaks 8d4c8e1498 [analyzer] Add -analyzer-purge option which can take on multiple values, remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.)
llvm-svn: 140838
2011-09-30 02:03:00 +00:00
David Blaikie 0cc494361c Renaming PathDiagnosticClients.h to PathDiagnosticConsumers.h (issue 5397)
llvm-svn: 140596
2011-09-27 01:43:33 +00:00
David Blaikie 53c125d063 Rename PathDiagnosticClient to PathDiagnosticConsumer as per issue 5397
llvm-svn: 140492
2011-09-26 00:51:36 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Douglas Gregor 79a91418bd Switch LangOptions over to a .def file that describes header of the
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
2011-09-13 17:21:33 +00:00
Anna Zaks dfbea6b244 [analyzer] -analyze-function for ObjectiveC should check if any of the methods match the name (not only the first one).
llvm-svn: 139439
2011-09-10 00:12:23 +00:00
Jordy Rose 087611ed81 [analyzer] Remove TransferFuncs.h, then deal with the fallout.
And with that, TransferFuncs is gone!

llvm-svn: 139003
2011-09-02 08:02:59 +00:00
Jordy Rose c49ec53e29 [analyzer] Move the knowledge of whether or not GC is enabled for the 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
2011-09-02 05:55:19 +00:00
Ted Kremenek 60120fb1b1 [analyzer] Pull body of loop in AnalysisConsumer::HandleDeclContext() into its own method. No real functionality change.
llvm-svn: 138712
2011-08-27 21:28:09 +00:00
Jordy Rose 9c09ce48b4 Fix typo.
llvm-svn: 137814
2011-08-17 05:00:56 +00:00
Jordy Rose 075d73bcce [analyzer] Add a warning for an incompatible plugin version.
llvm-svn: 137813
2011-08-17 04:56:03 +00:00
Benjamin Kramer 8b3929d956 Silence compiler warnings by casting object pointers to function pointers via intptr_t.
This is ugly but ISO C++ doesn't allow direct casts.

llvm-svn: 137812
2011-08-17 04:22:25 +00:00
Jordy Rose 93b86e494d [analyzer] Add basic support for pluggable checkers.
llvm-svn: 137802
2011-08-17 01:30:59 +00:00
Jordy Rose 59cce71af6 [analyzer] Overhaul of checker registration in preparation for basic plugin 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
2011-08-16 21:24:21 +00:00
Ted Kremenek 5ef32dbf2a Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.
llvm-svn: 137537
2011-08-12 23:37:29 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
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
2011-07-25 16:49:02 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Ted Kremenek 5f06955aa0 Teach static analyzer to analyze Objective-C methods in category implementations.
llvm-svn: 131614
2011-05-19 00:56:53 +00:00
Ted Kremenek e69ab05f6e Add Checker callback for running a checker at the end of processing an entire TranslationUnit. Patch by Lei Zhang.
llvm-svn: 130913
2011-05-05 03:41:17 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Argyrios Kyrtzidis 437758cbe6 [analyzer] For -analyzer-checker-help show all the info about groups, packages, and which packages/checkers are hidden.
llvm-svn: 128511
2011-03-29 23:57:38 +00:00
Argyrios Kyrtzidis 29b8656935 [analyzer] Remove unused checker stuff from AnalysisConsumer and some unused headers.
llvm-svn: 126690
2011-02-28 22:30:38 +00:00
Argyrios Kyrtzidis 9eb02dfa89 [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.
llvm-svn: 126676
2011-02-28 19:49:42 +00:00
Argyrios Kyrtzidis 6a1c760760 [analyzer] Run the ExprEngine depending on the CheckerManager having path-sensitive checkers.
llvm-svn: 126674
2011-02-28 19:49:17 +00:00
Argyrios Kyrtzidis 20f5caa518 [analyzer] The current UninitializedValuesChecker will go away, remove '-warn-uninit-values'.
llvm-svn: 126673
2011-02-28 19:49:12 +00:00
Argyrios Kyrtzidis 2c49ec7f1d [analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.
They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that
DereferenceChecker can dispatch.
ImplicitNullDerefEvent is when we dereferenced a location that may be null.

llvm-svn: 126659
2011-02-28 17:36:18 +00:00
Argyrios Kyrtzidis a15dfec3f5 [analyzer] Introduce "event" mechanism in CheckerManager.
A checker can register as receiver/listener of "events" (basically it registers a callback
with a function getting called with an argument of the event type) and other checkers can
register as "dispatchers" and can pass an event object to all the listeners.
This allows cooperation amongst checkers but with very loose coupling.

llvm-svn: 126658
2011-02-28 17:36:09 +00:00
Argyrios Kyrtzidis 98b570ecad [analyzer] Run AST checkers for ObjCMethodDecls.
llvm-svn: 126657
2011-02-28 17:36:04 +00:00
Argyrios Kyrtzidis 0a9ce3ec8f [analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.
Turns -analyzer-check-buffer-overflows into -analyzer-checker=core.experimental.Overflow

llvm-svn: 126609
2011-02-28 01:26:57 +00:00
Argyrios Kyrtzidis 560bbb1241 [analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats
llvm-svn: 126608
2011-02-28 01:26:50 +00:00
Argyrios Kyrtzidis 21c9423ef4 [analyzer] Remove '-analyzer-experimental-checks' flag.
llvm-svn: 126607
2011-02-28 01:26:43 +00:00
Argyrios Kyrtzidis 17bee3e70a Intoduce '-analyzer-checker-help' flag which outputs a list of all available static analyzer checkers.
This is pretty basic for now, eventually checkers should be grouped according to package, hidden checkers should be indicated etc.

llvm-svn: 126454
2011-02-25 00:09:51 +00:00
Argyrios Kyrtzidis b388f77ad9 [analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't have any checkers associated with it anymore.
llvm-svn: 126440
2011-02-24 21:43:08 +00:00