Commit Graph

699 Commits

Author SHA1 Message Date
Chris Lattner 47fb9efa5d Fix rdar://5843510 don't assert and die when an invalid output
file is specified, print a happy little error message.

llvm-svn: 49518
2008-04-11 06:14:11 +00:00
Ted Kremenek 22bd628056 Fix some bonehead bugs in summary generation in CFRefCount.
llvm-svn: 49503
2008-04-10 22:58:08 +00:00
Ted Kremenek 4a78c3ae11 Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver.

Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref.

llvm-svn: 49500
2008-04-10 22:16:52 +00:00
Ted Kremenek d4db4fa359 For -emit-html, use the Rewriter to expand tabs.
llvm-svn: 49409
2008-04-08 23:25:54 +00:00
Ted Kremenek 5f7ece0bff Don't expand tabs in EscapeText, but rather expand them when writing out
the HTML file.  This should reduce the amount of memory pressure on the
rewriter for files that have a lot of tabs.

llvm-svn: 49406
2008-04-08 22:37:58 +00:00
Ted Kremenek d8256ed2fe Improve range highlighting in HTMLDiagnostic to correctly highlight ranges
that span multiple lines by inserting multiple "</span>" and "<span>" tags.

llvm-svn: 49403
2008-04-08 21:29:14 +00:00
Chris Lattner 4fdfbf7b89 silence some warnings when assertions are disabled.
llvm-svn: 49372
2008-04-08 05:52:18 +00:00
Chris Lattner aa9c7aed0f Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

llvm-svn: 49369
2008-04-08 04:40:51 +00:00
Chris Lattner 2163265b53 Fix rdar://5846705: "clang -E foo.c -o foo.i" should remove foo.i on error.
llvm-svn: 49368
2008-04-08 04:16:20 +00:00
Chris Lattner 0a5ff0d34a This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!

llvm-svn: 49261
2008-04-06 04:47:34 +00:00
Chris Lattner 9d51f2b9d4 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.

llvm-svn: 49251
2008-04-05 06:32:51 +00:00
Steve Naroff 4dbab8a49d Avoid implicitly including any header files (requested by ckane).
llvm-svn: 49241
2008-04-04 22:58:22 +00:00
Steve Naroff af91b9ae13 Rewrite @package (an ObjC 2.0 idiom).
llvm-svn: 49238
2008-04-04 22:34:24 +00:00
Steve Naroff eae91700de Fix MS-specific bug in RewriteTest::RewriteObjCMethodDecl().
llvm-svn: 49237
2008-04-04 22:23:44 +00:00
Chris Lattner c5ffed4a66 Introduce ContextDecl, patch by Argiris Kirtzidis!
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema

llvm-svn: 49208
2008-04-04 06:12:32 +00:00
Ted Kremenek b5c8225320 Use logical line number for BUGLINE.
llvm-svn: 49178
2008-04-03 17:55:57 +00:00
Ted Kremenek b73d6dda84 Added guard for printing out PathDiagnostics whose last element ends with
a piece with a SourceLocation that does not have a FileID.

llvm-svn: 49151
2008-04-03 07:13:10 +00:00
Sam Bishop 03e662d5be Call delete on the deserialized TranslationUnit object.
llvm-svn: 49136
2008-04-03 05:03:34 +00:00
Ted Kremenek 258493c188 Added path sequence numbers in HTML output of PathDiagnostics.
llvm-svn: 49116
2008-04-02 21:04:20 +00:00
Ted Kremenek 3276af4c1a Embed BUGLINE, BUGFILE, BUGPATHLENGTH in the emitted HTML file.
llvm-svn: 49114
2008-04-02 20:44:16 +00:00
Ted Kremenek 13c0885a8d Put "BUGDESC" comment tag on its own line.
llvm-svn: 49103
2008-04-02 18:03:20 +00:00
Ted Kremenek e6eed29125 Embed "DESC" tag in HTML reports.
llvm-svn: 49084
2008-04-02 07:04:46 +00:00
Chris Lattner 595cf9ff81 Update to match simplified llvm MemoryBuffer interfaces for files.
llvm-svn: 49042
2008-04-01 18:04:30 +00:00
Ted Kremenek a9590d1c0d Embed linkable IDs in message bubbles.
llvm-svn: 49005
2008-03-31 23:30:12 +00:00
Ted Kremenek 3bcfc6edc0 Better handling for tabs with message bubbles.
llvm-svn: 49001
2008-03-31 23:14:05 +00:00
Ted Kremenek 01fa5d2a1e When emitting HTML messages, take into account margin fusing due to tabs.
llvm-svn: 48998
2008-03-31 21:40:14 +00:00
Ted Kremenek c27815ca82 Inlined clang/Analysis/Analyses/GRSimpleVals.h into LocalCheckers.h and removed
GRSimpleVals.h

Added a PathDiagnosticClient option to the driver functions for the
CFRefCountChecker and the GRSimpleVals analysis. Both analyses now accept a "-o"
argument from the driver that specifies where HTML reports should be dumped.

llvm-svn: 48989
2008-03-31 18:26:32 +00:00
Ted Kremenek 9c7deb8d25 Disable timing diagnostics for GRSimpleVals.
llvm-svn: 48981
2008-03-31 16:00:32 +00:00
Steve Naroff f9e7c90129 Only have the rewriter produce a file when there are no errors.
llvm-svn: 48926
2008-03-28 22:26:09 +00:00
Steve Naroff 60a9ef67e2 Add some of Ted's recent work to the VC++ project file.
Fix a couple bozo bugs in the rewriter.

llvm-svn: 48903
2008-03-27 22:59:54 +00:00
Steve Naroff 00a317694b Collect all the preamble code and don't insert it until the end.
llvm-svn: 48899
2008-03-27 22:29:16 +00:00
Ted Kremenek 30560caa3d For HTMLDiagnostics, when emitting the name of the directory, substitute the current working directory for "."
llvm-svn: 48888
2008-03-27 17:25:28 +00:00
Ted Kremenek 561dfe3153 Add html::EscapeText for std::string; use this function to escape text in message bubbles.
llvm-svn: 48884
2008-03-27 17:15:29 +00:00
Ted Kremenek ed9f054a9c Don't emit any timings for GRSimple if the CFG is not going to be built.
llvm-svn: 48882
2008-03-27 17:14:42 +00:00
Ted Kremenek 8d5491f40c Output directory as well as file name.
llvm-svn: 48870
2008-03-27 07:39:04 +00:00
Ted Kremenek 8cc4842a76 Added <h3> tag in HTML file output that contains the name of the source file.
llvm-svn: 48869
2008-03-27 07:35:49 +00:00
Ted Kremenek 6efb026623 Added "HTMLDiagnostic", a generic DiagnosticClient (that also implements PathDiagnostic)
so that all diagnostics can be piped to HTML files instead of as text diagnostics using --html-diags.

llvm-svn: 48865
2008-03-27 06:17:42 +00:00
Ted Kremenek c875201ee1 Fixed copy-paste error.
llvm-svn: 48863
2008-03-27 05:52:45 +00:00
Steve Naroff 65838bb2d5 Add a couple files to VC++ project and cleanup an "#if 0".
llvm-svn: 48748
2008-03-24 22:03:25 +00:00
Andrew Lenharth 10051b97fd debian amd64 testing
llvm-svn: 48745
2008-03-24 21:39:05 +00:00
Andrew Lenharth d8cde6f45d debian ia32 testing
llvm-svn: 48742
2008-03-24 21:25:48 +00:00
Chris Lattner 97d496c182 Teach the rewriter how to respect the -o option.
llvm-svn: 48669
2008-03-22 00:08:40 +00:00
Ted Kremenek bc24962566 Added HTML highlighting for ranges.
llvm-svn: 48572
2008-03-19 23:55:53 +00:00
Ted Kremenek 1651b7cd2d Misc. cleanups to HTML printing: make code rendered using tables; add
better div positioning for messages.

llvm-svn: 48555
2008-03-19 21:59:05 +00:00
Ted Kremenek 216624ce58 Initial experimentation with adding boxed "annotations" to HTMLized source.
llvm-svn: 48540
2008-03-19 07:53:42 +00:00
Ted Kremenek 966da4acc3 Moved generation of html header/footer with builtin CSS to the rewriter library.
llvm-svn: 48537
2008-03-19 06:14:37 +00:00
Ted Kremenek 3f8392626b More cleanups to the HTML rewriter (with line formatting), with better
pretty-printing of line numbers.

llvm-svn: 48533
2008-03-19 05:07:26 +00:00
Ted Kremenek 5ddff02861 More cleanups to HTML rewriter API: remove the InsertTag method; was too complicated
and clients can achieve a cleaner design just by inserting tags directly.  Reserve
the "html" namespace for meta-level operations (e.g., escaping text, etc.)

llvm-svn: 48524
2008-03-19 01:30:02 +00:00
Ted Kremenek 8800ae68a0 More HTML rewriter cleanups. Preliminary CSS support in code pretty-printing.
llvm-svn: 48518
2008-03-18 23:55:46 +00:00
Ted Kremenek 5792cebb08 Some cleanups to the HTMLRewrite API. Added support for printing out line
numbers (more work to be done on aesthetics).

llvm-svn: 48512
2008-03-18 23:08:51 +00:00
Ted Kremenek b0c409a235 Added HTML pretty-printer.
llvm-svn: 48507
2008-03-18 22:21:07 +00:00
Ted Kremenek 7dcc82220e Added the beginning of a set of rewriter functions for pretty-printing source
code as HTML.  Added a new driver option "--emit-html" to dump the source
of the main input file as HTML.

llvm-svn: 48505
2008-03-18 21:19:49 +00:00
Steve Naroff 327f0f4c3a Fix <rdar://problem/5716940> rewriter generates invalid C code when no selector found.
llvm-svn: 48479
2008-03-18 02:02:04 +00:00
Steve Naroff 034bcb5bfa Wrap up __NSConstantStringImpl (the replacement for __builtin___CFStringMakeConstantString).
llvm-svn: 48477
2008-03-18 01:47:18 +00:00
Chris Lattner 5bb4ee20cd clean up iteration over propertydecls.
llvm-svn: 48435
2008-03-17 01:24:41 +00:00
Chris Lattner ed0e16404c clean up property memory allocation to move it into the ast classes
like the rest of the classes.

llvm-svn: 48434
2008-03-17 01:19:02 +00:00
Chris Lattner 41eec3d097 make property addition work list all other "add" methods. Do
the allocation in the class, not in sema.

llvm-svn: 48433
2008-03-16 21:23:50 +00:00
Chris Lattner 8d1c04f53a Convert more counts to be zero based instead of -1 based, make them unsigned.
llvm-svn: 48429
2008-03-16 21:08:55 +00:00
Chris Lattner acc04a9261 minor cleanups, make getNumInstanceMethods always return unsigned.
llvm-svn: 48423
2008-03-16 20:19:15 +00:00
Chris Lattner 011b0f5c5a Make the parameter count of ObjCMethodDecl unsigned, you
can't have negative arguments.

llvm-svn: 48407
2008-03-16 01:07:14 +00:00
Chris Lattner ee1284a6e2 switch the rest of the C decl classes to do their
allocation through ASTContext.

llvm-svn: 48403
2008-03-16 00:16:02 +00:00
Chris Lattner 96c460d142 move the ASTContext argument to be first in the argument list of
all Create methods.

llvm-svn: 48398
2008-03-15 21:32:50 +00:00
Chris Lattner 5072bae709 Switch over functiondecl. This makes it obvious that the ASTContext
argument to Create should be first, not last.

llvm-svn: 48397
2008-03-15 21:24:04 +00:00
Chris Lattner 4b08ca8f2e switch the VarDecl allocation model to go through ASTContext.
llvm-svn: 48396
2008-03-15 21:10:16 +00:00
Chris Lattner a7b3287760 start switching decls over to using an allocator controlled by ASTContext.
Right now only some ctors are switched over.  I need to switch them all
over so I can change the dtor over.

This lets us experiment with region allocation and other things in the 
future.

llvm-svn: 48390
2008-03-15 06:12:44 +00:00
Steve Naroff dad80ba9b1 Link against the correct ObjC string class (__CFConstantStringClassReference) and fix length computation (removing a FIXME).
llvm-svn: 48384
2008-03-15 01:36:04 +00:00
Steve Naroff ce8e886731 Remove ObjC rewriter dependency on GCC's __builtin___CFStringMakeConstantString.
llvm-svn: 48383
2008-03-15 00:55:56 +00:00
Ted Kremenek 9abb59f9cc Emit warnings for undefined control-flow.
llvm-svn: 48368
2008-03-14 18:14:50 +00:00
Ted Kremenek 7b00d15bc5 Path-sensitive analyses no longer take a FunctionDecl, but any Decl representing
a block of "code".

Patched various ASTConsumers (such as ASTDumper) to have more support for
processing ObjCMethodDecl. CFGVisitor now builds CFGs for ObjCMethodDecls.

llvm-svn: 48363
2008-03-14 17:31:00 +00:00
Chris Lattner e8ec280627 Only compute targetinfo once and don't leak it. Patch by Sam Bishop!
llvm-svn: 48358
2008-03-14 06:12:05 +00:00
Ted Kremenek 1fdd0a480e The LiveVariables analysis no longer requires a FunctionDecl&; this allows it
to be run on other declarations of blocks of code (e.g., Objective-C methods.)

llvm-svn: 48339
2008-03-13 16:55:07 +00:00
Ted Kremenek b64d183803 Added bandaid support in CFG construction for ObjCForEachStmt and ObjCAtTryStmt:
we gracefully back out and return NULL for the CFG, allowing clients to skip
analyzing functions with these CFGs. We will add support later.

Modified base ASTConsumer "CFGVisitor" to detect when a CFG is not constructed
and to emit a warning.

llvm-svn: 48322
2008-03-13 03:04:22 +00:00
Steve Naroff 35cb7960e3 Two fixes to RewriteTest::RewriteObjCIvarRefExpr():
- For explicit ivar refers, make sure the cast is propagated to the AST.
- Don't free the base (since it is still in use).
This fixes the recent regression to test/Rewriter/objc-ivar-receiver-1.m.

llvm-svn: 48309
2008-03-12 23:15:19 +00:00
Steve Naroff ffb5f9ad93 Minor aesthetic improvement (after I reviewed my last commit).
llvm-svn: 48304
2008-03-12 21:22:52 +00:00
Steve Naroff 9f33bd2c34 Avoid using the "unnamed struct field" extension (enabled with -fms-extensions). This feature/extension silently does the wrong thing in g++. As far as I can tell, g++ simply throws the field away entirely (note that it works fine with gcc). Since I am now always casting the object (for other reasons), accessing protected/public fields simply requires the cast refer to the defining class. This solution is simpler all around (thanks to Chris for suggesting it).
llvm-svn: 48302
2008-03-12 21:09:20 +00:00
Steve Naroff b327e49047 Use the "used" attribute. Without it, g++ removes all the meta-data:-( This doesn't happen when compiling straight C code.
llvm-svn: 48287
2008-03-12 17:18:30 +00:00
Steve Naroff 5d5efca405 -Add missing visitor for ObjCIvarRefExpr.
-Wrap objc runtime calls with "extern "C"" (for now).

llvm-svn: 48284
2008-03-12 13:19:12 +00:00
Steve Naroff 251084d03e Remove more dependencies on C "flexible array member" idiom (when generating meta-data).
llvm-svn: 48271
2008-03-12 01:06:30 +00:00
Steve Naroff dc5b6b2e5d Make ivar rewrite C++ friendly (since C++ forces a unified namespace for typedefs/structures). The previous version of the rewriter generated both a type def and structure def for each class (which doesn't fly in C++).
llvm-svn: 48266
2008-03-12 00:25:36 +00:00
Steve Naroff 0b844f053f Make "super" rewrite for class methods C++ friendly (follow-up from last commit).
llvm-svn: 48235
2008-03-11 18:14:26 +00:00
Steve Naroff 17978c4dcb Make "super" rewrite C++ friendly (since it doesn't support Compound Literals).
llvm-svn: 48230
2008-03-11 17:37:02 +00:00
Steve Naroff c5b9cc70ce Generate meta-data in a C++ compatible way (remove 2 dependencies on C "flexible array member" idiom and perform some extra casts).
llvm-svn: 48202
2008-03-11 00:12:29 +00:00
Steve Naroff 14a0746b13 Missed a couple "_IMPL" suffixes.
llvm-svn: 48191
2008-03-10 23:33:22 +00:00
Steve Naroff a1e115ee57 Fix dangling pointer and give the implementation struct for a class a unique name.
llvm-svn: 48190
2008-03-10 23:16:54 +00:00
Steve Naroff 945a3b145a Pass LangOptions to RewriteTest().
llvm-svn: 48172
2008-03-10 20:43:59 +00:00
Chris Lattner 0d799d3957 Add some missing #includes for GCC mainline, patch by Shantonu Sen!
llvm-svn: 48153
2008-03-10 17:04:53 +00:00
Chris Lattner 6af064641f Fix a ted-o
llvm-svn: 48089
2008-03-09 05:25:01 +00:00
Chris Lattner 22ad07ca07 simplify triple processing code now that there can be only one arch specified.
llvm-svn: 48066
2008-03-09 01:35:13 +00:00
Ted Kremenek 2bdd77696e Added --trim-path-graph to the driver to trim paths from the ExplodedGraph
that are not related to error nodes.

Fixed bug where we did not detect some NULL dereferences.

Added "ExplodedGraph::Trim" to trim all nodes that cannot transitively reach
a set of provided nodes.

Fixed subtle bug in ExplodedNodeImpl where we could create predecessor
iterators that included the mangled "sink" bit.  The better fix is to integrate
this bit into the void* for the wrapped State, not the NodeGroups representing
a node's predecessors and successors.

llvm-svn: 48036
2008-03-07 22:58:01 +00:00
Ted Kremenek ea6507fe04 Added boilerplate to execute the CF reference count checker (which isn't yet implemented).
llvm-svn: 47982
2008-03-06 00:08:09 +00:00
Chris Lattner 37e0587839 remove the source location arguments to various target query methods.
llvm-svn: 47954
2008-03-05 18:54:05 +00:00
Chris Lattner 855d024a83 Remove the first layer of support for "portability" warnings. This is
theoretically useful, but not useful in practice.  It adds a bunch of 
complexity, and not much value.  It's best to nuke it.  One big advantage
is that it means the target interfaces will soon lose their SLoc arguments
and target queries can never emit diagnostics anymore (yay).  Removing this
also simplifies some of the core preprocessor which should make it slightly
faster.

Ted, I didn't simplify TripleProcessor, which can now have at most one
triple, and can probably just be removed.  Please poke at it when you have
time.

llvm-svn: 47930
2008-03-05 01:18:20 +00:00
Chris Lattner 028d6d5792 avoid a warning.
llvm-svn: 47839
2008-03-03 05:57:43 +00:00
Chris Lattner 184adbfe5b Find clang headers in the clang headers dir, search it before
the system headers dir.  This produces an annoying warning:
clang.cpp:883: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object

I'm not sure how to remove it. :(

llvm-svn: 47836
2008-03-03 03:16:03 +00:00
Chris Lattner c1bc541323 Add support for the CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
OBJC_INCLUDE_PATH, and OBJCPLUS_INCLUDE_PATH environment variables.
Patch by Sam Bishop!

llvm-svn: 47785
2008-03-01 08:07:28 +00:00
Chris Lattner bb7bc8d4f0 fix an interaction between -isystem . and isysroot.
llvm-svn: 47646
2008-02-26 23:46:22 +00:00
Chris Lattner eb85ab44f2 convert tabs to spaces, patch by Mike Stump!
llvm-svn: 47560
2008-02-25 21:04:36 +00:00
Chris Lattner cb0d62c70d enable digraphs for C94, thanks to Neil for pointing this out.
llvm-svn: 47543
2008-02-25 04:01:39 +00:00
Ted Kremenek c77f34daad Modified clang driver option -dump-live-variables to (optionally) use the
--analyze-function option to analyze specific functions.

llvm-svn: 47498
2008-02-22 20:13:09 +00:00
Ted Kremenek 88329bf0ea clang driver options --dump-cfg and --view-cfg now (optionally) use the
--analyze-function option to dump/view the CFGs of specific functions.

llvm-svn: 47497
2008-02-22 20:00:31 +00:00