Commit Graph

35 Commits

Author SHA1 Message Date
Ted Kremenek fe0fc40c3b Move BugReporter.h, PathDiagnostic.h, and BugType.h to 'include/Checker/BugReporter'
llvm-svn: 94428
2010-01-25 17:10:22 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Mike Stump 281d6d7745 Use the llvm coding convention for indentation for switch.
llvm-svn: 93966
2010-01-20 02:03:14 +00:00
Ted Kremenek a3536e23c8 Try to make the output of PlistDiagnostics more deterministic by sorting PathDiagnostics before they are emitted. Fixes <rdar://problem/7439668>.
llvm-svn: 90478
2009-12-03 19:35:02 +00:00
Benjamin Kramer 16634c2c5a Remove VISIBILITY_HIDDEN from anonymous namespaces in libFrontend.
llvm-svn: 90033
2009-11-28 10:07:24 +00:00
Ted Kremenek 2466e0d92f Only flush plist diagnostics once.
llvm-svn: 87073
2009-11-13 03:14:14 +00:00
Ted Kremenek da00234109 Fix recently introduced use-after-free error reported in <rdar://problem/7387478>.
llvm-svn: 87072
2009-11-13 03:02:57 +00:00
Daniel Dunbar b5f2025b77 Convert CreateAnalysisConsumer and friends to just take a const Preprocessor&, and simplify.
llvm-svn: 86112
2009-11-05 02:41:58 +00:00
Ted Kremenek 5e86044ec4 Acting on Daniel's nagging, remove PathDiagnosticClientFactory() and
migrate work in the destructors of PathDiagnosticClients from their
destructors to FlushReports().  The destructors now currently call
FlushReports(); this will be fixed in a subsequent patch.

llvm-svn: 86108
2009-11-05 02:09:23 +00:00
Daniel Dunbar d0ba0e6108 Kill PreprocessorFactory, which was both morally repugnant and totally unused.
llvm-svn: 86076
2009-11-04 23:56:25 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Dan Gohman a98e0e73de Update clang for raw_fd_ostream no longer requiring F_Force.
llvm-svn: 79991
2009-08-25 15:36:09 +00:00
Chris Lattner 84cffc22d4 adjust for raw_fd_ostream api change.
llvm-svn: 79809
2009-08-23 02:59:41 +00:00
Daniel Dunbar 841f14b609 Add missing '"'
llvm-svn: 77416
2009-07-29 01:10:25 +00:00
Ted Kremenek 04ade6f1cb (1) Enable PlistDiagnostics to take an option "PathDiagnosticClientFactory"
object that it can use to forward PathDiagnostics for further processing. Along
with this feature, the PlistDiagnostics object logs which files are created by
the forwarding of the PathDiagnostics.

(2) Create a new PathDiagnosticClientFactory object for HTMLDiagnostics,
allowing other PathDiagnosticClients to forward PathDiagnostics through an
opaque interface.

(3) Create a "plist-html" diagnostics option in AnalysisConsumer to allow the
    logging of HTML files created in a hybrid Plist+HTML diagnostic client.

llvm-svn: 77264
2009-07-27 22:13:39 +00:00
Dan Gohman 74e3eb49ea Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.

llvm-svn: 75802
2009-07-15 17:32:18 +00:00
Ted Kremenek 47187c6ad2 BugReporter/PathDiagnostics:
- Add an (optional) short description for BugReports for clients that want
  to distinguish between long and short descriptions for bugs
- Make the bug report for VLA less obscene for Plist diagnostics by using
  the short description

llvm-svn: 70415
2009-04-29 21:58:13 +00:00
Ted Kremenek 63e29cc99c Add PathDiagnosticRange to PathDiagnostics. These simply wrap SourceRange and
indicate whether or not the range represents an absolute range or should be
extended by lexing to the end of the token.

llvm-svn: 69834
2009-04-22 22:26:10 +00:00
Ted Kremenek 01c9af18c9 Plist diagnostics: Remove deprecated single-point locations in control-flow
pieces.

llvm-svn: 69719
2009-04-21 21:03:00 +00:00
Chris Lattner 184e65d363 Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~ ^

Most of this is just plumbing to push the reference around.

llvm-svn: 69099
2009-04-14 23:22:57 +00:00
Ted Kremenek d3ebd551b9 Fix output of ranges in analyzer plist files.
llvm-svn: 68437
2009-04-05 02:08:28 +00:00
Ted Kremenek 12f510aa8f Hack: Add 'PathDiagnostic::flattenLocations()'. Because PlistDiagnosticClient
can use a PathLocation after any reference Stmts are reclaimed,
flattenLocation() converts those references to statements to source ranges.

llvm-svn: 68292
2009-04-02 05:13:24 +00:00
Ted Kremenek 1e5d9439b8 For plist diagnostics, use the extensive PathDiagnostic generation algorithm.
llvm-svn: 68264
2009-04-02 00:44:18 +00:00
Ted Kremenek 0bb0909233 - Changed PathDiagnosticPiece::getLocation() to return a PathDiagnosticLocation
instead of a FullSourceLoc. This resulted in a bunch of small edits in various
  clients.
- Updated BugReporter to include an alternate PathDiagnostic generation
  algorithm for PathDiagnosticClients desiring more control-flow pieces.

llvm-svn: 68193
2009-04-01 06:13:56 +00:00
Ted Kremenek 4e81c3ccac Allow two codepaths for PathDiagnostic generation. This patch mainly consists of
refactoring to make this possible (no functionality change).

llvm-svn: 68141
2009-03-31 20:22:36 +00:00
Ted Kremenek ae1aa43617 Properly escape special characters in <string>'s in plist file.
llvm-svn: 67924
2009-03-28 06:40:54 +00:00
Ted Kremenek 15b3753858 analyzer plist: For PathDiagnosticControlFlowPieces, now output an array of
start-end points, where start and end are source ranges.

llvm-svn: 67847
2009-03-27 15:53:20 +00:00
Ted Kremenek 073da05fa4 Emit aggregate "location" for PathDiagnostic to plist. This fixes <rdar://problem/6729558>.
llvm-svn: 67845
2009-03-27 15:31:11 +00:00
Ted Kremenek a7ec0ded63 BugReporter:
- Added an internal helper class 'PathDiagnosticBuilder' which now bundles the
  'ExecutionContinues' methods.
- Added preliminary diagnostics for short-circuit '&&' and '||'

llvm-svn: 67822
2009-03-27 05:06:10 +00:00
Ted Kremenek 842f858865 Plist diagnostics: distinguish between regular and extended messages for "events".
llvm-svn: 67269
2009-03-19 00:42:56 +00:00
Ted Kremenek 9d1ce8faae PathDiagnostics:
- PathDiagnosticControlFlowPiece now consists of a "start" and "end" location
  to indicating the branch location and where the branch goes.

BugReporter:
- Updated BugReporter to construct PathDiagnosticControlFlowPiece objects with
  "end" locations.

PlistDiagnostics:
- Plists now contain the bug "type" (not just bug "category")
- Plists now encode control-flow pieces differently than events; now the
  "start" and "end" locations are recorded

llvm-svn: 66818
2009-03-12 18:41:53 +00:00
Ted Kremenek 493a4242d9 Handle "Macro" PathDiagnosticPiece kind when getting string identifier.
llvm-svn: 66518
2009-03-10 02:49:29 +00:00
Ted Kremenek 53b72b4fea Plist diagnostics now include PathDiagnostPiece::Kind.
llvm-svn: 65878
2009-03-02 21:44:02 +00:00
Ted Kremenek 353e40211c For now, do not output the 'DisplayHint' in plist files.
llvm-svn: 65861
2009-03-02 19:40:15 +00:00
Daniel Dunbar 51adf5824e Rename lib/Driver (etc) to lib/Frontend in prep for the *actual*
driver taking lib/Driver.

llvm-svn: 65811
2009-03-02 06:16:29 +00:00