Граф коммитов

51 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek be1fe1eb12 Static Analyzer driver/options (partial) cleanup:
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
   -analyzer-output=...
   -analyzer-store=...
   -analyzer-constraints=...
  instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
  interface
- Updated test cases to conform to new driver options


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 04:27:41 +00:00
Ted Kremenek f06e9c54cb RangeConstraintManager is not on by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 17:26:11 +00:00
Ted Kremenek 4502195fec Patch by Ben Laurie:
ConstraintManager:
- constify getSymVal()

BasicConstraintManager:
- Pull out logic that would be common to ConstraintManagers of a similar nature
  and put them in a parent class called 'SimpleConstraintManager'.

RangeConstraintManager:
- Added a new prototype ConstraintManager to track ranges of variables! This
  ConstraintManager keeps tracks of ranges of concrete integers that a symbolic
  integer may have.

AnalysisConsumer:
- Add driver option to use RangeConstraintManager with GRExprEngine-based
  analyses.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 17:08:39 +00:00
Ted Kremenek 4d53a53b81 AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTranslationUnit to ensure that the client's destructor is called even with --disable-free.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:51:30 +00:00
Ted Kremenek cf118d41f7 Overhaul BugReporter interface and implementation. The new interface cleans up
the ownership of BugTypes and BugReports. Now BugReports are owned by BugTypes,
and BugTypes are owned by the BugReporter object.

The major functionality change in this patch is that reports are not immediately
emitted by a call to BugReporter::EmitWarning (now called EmitReport), but
instead of queued up in report "equivalence classes". When
BugReporter::FlushReports() is called, it emits one diagnostic per report
equivalence class. This provides a nice cleanup with the caching of reports as
well as enables the BugReporter engine to select the "best" path for reporting a
path-sensitive bug based on all the locations in the ExplodedGraph that the same
bug could occur.

Along with this patch, Leaks are now coalesced into a common equivalence class
by their allocation site, and the "summary" diagnostic for leaks now reports the
allocation site as the location of the bug (this may later be augmented to also
provide an example location where the leak occurs).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 23:49:09 +00:00
Ted Kremenek 81922f0135 AnalysisConsumer:
- Pass "Actions" vector by reference.
- Remove guard against checking macro-generated code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63546 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 20:52:40 +00:00
Chris Lattner b9c3f966b1 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 07:57:44 +00:00
Ted Kremenek 491918ee2f Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:52:26 +00:00
Ted Kremenek c472d79e3a When using -analyzer-output-plist always output a plist file even if it contains no error reports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:06:20 +00:00
Zhongxing Xu ff944a8c48 Add an option to make 'RemoveDeadBindings' a configurable behavior. This enables
us to measure the effect of this optimization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 01:52:37 +00:00
Ted Kremenek ca9bab0dcb Update Driver to new interface for LiveVariables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60732 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 00:17:51 +00:00
Zhongxing Xu 22438a8dfe Add support for pluggable components of static analyzer.
- Creator function pointers are saved in ManagerRegistry.
 - The Register* class is used to notify ManagerRegistry new module is 
   available.
 - AnalysisManager queries ManagerRegistry for configurable module. Then it
   passes them to GRExprEngine, in turn to GRStateManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:55:08 +00:00
Ted Kremenek 8ffc8a571f Display the function we are analyzing before running LiveVariables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 20:53:32 +00:00
Chris Lattner 077bf5e2f4 Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:33:13 +00:00
Ted Kremenek a88fcef963 Output 'ANALYZE' messages to standard error. This should address the intermixing of 'ANALYZE' and the other diagnostics the clang driver emits to standard error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59730 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:14:48 +00:00
Daniel Dunbar 26fb272713 [LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that
the Backend output should be done in binary mode.
 - I'd appreciate it if someone who has a Windows build could verify
   this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 05:09:21 +00:00
Ted Kremenek daac634c97 Patch by Nikita Zhuk: Add TranslationUnitActions to AnalysisConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07 02:09:25 +00:00
Ted Kremenek f304ddcf6b AnalysisManager can now be used to for analyses over TranslationUnits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 19:05:06 +00:00
Ted Kremenek 4fc82c8458 Hook up the Plist diagnostic client to the driver.
Fix Plist output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:18:07 +00:00
Ted Kremenek ad99dbfc1d Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:31:48 +00:00
Zhongxing Xu 3702af57e3 Adjust code format.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 05:03:28 +00:00
Ted Kremenek 95c7b00fe8 Make the analyzer store (memory model) a command line option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 01:04:59 +00:00
Ted Kremenek cfdf9b4edf Change implementation of NSError** coding-style check to be invoked at the end of the retain/release analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 21:25:13 +00:00
Ted Kremenek f45d18c08b Implemented one of the checks requested in PR 2600:
"Method accepting NSError** argument should have non-void return value to indicate that an error occurred."

Test case written, but the header needs to be delta-debugged reduced.  Will commit shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 06:33:41 +00:00
Ted Kremenek 628a42e04d Output "ANALYZE:" diagnostics to STDOUT instead of STDERR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 00:02:50 +00:00
Daniel Dunbar 932680ecde Add newline to end of file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 03:45:59 +00:00
Ted Kremenek 45479c88c8 Always print out the function we're analyzing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:34:41 +00:00
Ted Kremenek 56b98719b0 Ubigraph visualization: represent cached nodes with a different style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 05:02:09 +00:00
Ted Kremenek 710ad9343f Automatically execute ubiviz.
Cleanup ubigraph files when don't drawing the graphs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 03:54:51 +00:00
Ted Kremenek d1289327f7 Ubigraph-rendered ExplodedGraphs now have arrows and are oriented downward.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 22:46:55 +00:00
Ted Kremenek f8ce6991f4 Added Ubigraph visualization for the static analyzer (this is pretty alpha quality).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 22:31:43 +00:00
Zhongxing Xu 8148839c10 Moved HTMLDiagnostics to lib/Driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 02:33:36 +00:00
Ted Kremenek 4f4e7e4610 Fix regression when invoking the MissingDealloc analysis: disable this check when in -fobjc-gc-only mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 17:14:10 +00:00
Ted Kremenek 395aaf20d6 Add prototype implementation of unused ivar check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:45:26 +00:00
Ted Kremenek 78d46242e3 Moved registration of basic path-sensitive checks from GRSimpleVals.cpp to GRExprEngineInternalChecks.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 16:21:24 +00:00
Ted Kremenek f7f3c20a5d Provide an "Analysis Scope" for Analyses so checks can either be run on code declarations (bodies) or Objective-C @implementation blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 00:46:02 +00:00
Ted Kremenek fb9a48cf5e Break off declaration of Analysis enum into Analyses.def. The driver options in
clang.cpp now #include these definitions to create the command line options, and
AnalysisConsumer #includes this file to generate the switch statement to create
actions.

Renamed -check-objc-methodsigs to -warn-objc-methodsigs.

The "missing -dealloc" check is now optional: -warn-objc-missing-dealloc


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 23:41:13 +00:00
Ted Kremenek 0d8019e55c Add new check: -check-objc-methodsigs. This check scans methods in
ObjCImplementationDecls and sees if a ancestor class defines a method with the
same selector but with a different type signature. Right now it just compares
return types, and mainly looks at differences in primitive values. The checking
will be expanded in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:40:47 +00:00
Ted Kremenek 3cd483cbbf For the -dealloc checker, check the LangOptions to determine whether or not the code is compiled with GC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 14:35:01 +00:00
Ted Kremenek 7032f460fc Have BugReporter::getCFG and BugReporter::getLiveVariables returns pointers instead of references, because they can both fail
on functions we cannot construct full CFGs for yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 05:26:14 +00:00
Ted Kremenek db09a4dee2 Added static analysis check to see if a subclass of NSObject implements -dealloc, and whether or not that implementation calls [super dealloc].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 04:29:21 +00:00
Ted Kremenek e207558e9d Unify the code path for the Dead Stores checker to always use the BugReporter interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 23:16:33 +00:00
Ted Kremenek c095997b85 Refactored some of the BugReporter interface so that data such as the ASTContext&, PathDiagnosticClient*, can be provided by an external source.
Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 21:24:01 +00:00
Ted Kremenek 8b23361a6a GRExprEngine now expects the LiveVariables information to be provided by its creator.
This allows an optimization in AnalysisConsumer where the same LiveVariables information is used between multiple analyses.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 20:13:38 +00:00
Ted Kremenek 17fdf95523 Added version of CheckDeadStores that accepts a client-provided LiveVariables object.
Modified the DeadStores logic in AnalysisConsumer.cpp to use the LiveVariables object created by the AnalysisManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:39:20 +00:00
Ted Kremenek 902141f74a Moved logic for -dump-cfg and -view-cfg into AnalysisConsumer.
Renamed -dump-cfg to -cfg-dump, and -view-cfg to -cfg-view.  This naming better matches the same options for asts (e.g. -ast-dump).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53041 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:23:21 +00:00
Ted Kremenek 235e031e84 Move -dump-live-variables logic to AnalysisConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:11:29 +00:00
Ted Kremenek 34d7734b6e Migrate CheckerConsumer diagnostics to the new AnalysisConsumer interface.
Remove CheckerConsumer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53029 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 16:49:11 +00:00
Ted Kremenek bc46f34583 Move logic for "-checker-simple" to the new AnalysisConsumer interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 16:35:50 +00:00
Ted Kremenek b35a74a40c Migrated driver logic for running the CF retain/release checker over to the new AnalysisConsumer interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:44:58 +00:00