Commit Graph

806 Commits

Author SHA1 Message Date
Nico Weber 7094a5bfa8 do not serialize invalid asts. this fixes bug #2637
llvm-svn: 54590
2008-08-09 18:32:11 +00:00
Ted Kremenek 6231e7e4ec Unbreak SerializationTest and the Rewriter by doing the work in HandleTranslationUnit instead of the destructor.
llvm-svn: 54513
2008-08-08 04:15:52 +00:00
Ted Kremenek dcb5e38927 ParseAST now never releases the passed ASTConsumer. This is the responsibility of the client.
The motivation is that clients may either:

(a) query the ASTConsumer object after AST parsing to collect data/etc.
(b) reuse the ASTConsumer.

llvm-svn: 54502
2008-08-08 02:46:37 +00:00
Ted Kremenek 59f3553392 Remove unneeded #includes.
llvm-svn: 54478
2008-08-07 18:14:04 +00:00
Ted Kremenek 6b515b5b34 Micro cleanups.
llvm-svn: 54477
2008-08-07 18:13:12 +00:00
Ted Kremenek 31691ae862 Fix --html-diags in driver by delaying the construction of an HTMLDiagnosticClient until after we have created the Preprocessor object.
llvm-svn: 54472
2008-08-07 17:49:57 +00:00
Matthijs Kooijman 8dab3eec81 Let LLVMCodeGenWriter forward all the methods defined in ASTConsumer, to
prevent unexpected surprises later on.

llvm-svn: 54469
2008-08-07 16:04:15 +00:00
Steve Naroff c884aa8e84 Fix for <rdar://problem/6113807> clang ObjC rewriter: crash rewriting attached file
While this is a safe rewriter fix, there is still a need for some discussion (see report for more info).

llvm-svn: 54412
2008-08-06 15:58:23 +00:00
Nico Weber b5fc3c300a add a libDriver, for now only move the text diangostics stuff from Driver to there
llvm-svn: 54383
2008-08-05 23:33:20 +00:00
Steve Naroff dd514e01f2 Finish fixing <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C"
llvm-svn: 54367
2008-08-05 20:04:48 +00:00
Nuno Lopes d86aa9340d fix crash when printing diagnostics with tokens that span through more than one line
llvm-svn: 54365
2008-08-05 19:40:20 +00:00
Ted Kremenek 2c674f6dbb Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files.
llvm-svn: 54364
2008-08-05 18:50:11 +00:00
Steve Naroff 568bbf73b2 Fix <rdar://problem/6108119> clang ObjC rewriter: if no newline at end of input file, rewriter inserts #define on same line as closing brace
llvm-svn: 54363
2008-08-05 18:47:23 +00:00
Daniel Dunbar 1ff1d1fd51 Move AsmLabel into Declarator instead of just a parameter to
ActOnDeclarator.

llvm-svn: 54353
2008-08-05 16:28:08 +00:00
Daniel Dunbar 4983df37a7 Add more Parser/Sema support for GCC asm-label extension.
- ActOnDeclarator now takes an additional parameter which is the
   AsmLabel if used. Its unfortunate that this bubbles up this high,
   but we cannot just lump it in as an attribute without mistakenly
   *accepting* it as an attribute.
 - The actual asm-label itself is, however, encoded as an AsmLabelAttr
   on the FunctionDecl.
 - Slightly improved parser error recovery on malformed asm-labels.
 - CodeGen support still missing...

llvm-svn: 54339
2008-08-05 01:35:17 +00:00
Ted Kremenek 9898028742 Fix regression when invoking the MissingDealloc analysis: disable this check when in -fobjc-gc-only mode.
llvm-svn: 54319
2008-08-04 17:14:10 +00:00
Daniel Dunbar f4693e289a Add more output to clang -parse-print-callbacks
- Just added prints for all the action functions. Ideally this would
   be extended to print all the information for the actions.

llvm-svn: 54259
2008-08-01 00:41:12 +00:00
Ted Kremenek 8cf5045012 Fix regression in range highlighting in HTML output.
llvm-svn: 54181
2008-07-29 23:35:38 +00:00
Steve Naroff 873bd8497a Fix incomplete implementation for rewriting protocol refs.
<rdar://problem/6108127> clang ObjC rewriter: no translation of id <proto>

llvm-svn: 54163
2008-07-29 18:15:38 +00:00
Chris Lattner 3f6cd0bc76 remove some unneeded calls to getCanonicalType
llvm-svn: 54106
2008-07-26 22:36:27 +00:00
Chris Lattner f08932928c comment out #pragma mark and #warning directives.
llvm-svn: 54020
2008-07-25 16:37:06 +00:00
Chris Lattner b9c34de5c4 rewrite handling of the raw token stream in -rewrite-macros to lex
everything up front into a vector.  This makes it easier to scan around
the stream when needed.

llvm-svn: 54019
2008-07-25 16:29:12 +00:00
Steve Naroff 29788347b2 Fix RewriteObjC::RewriteObjCThrowStmt() to respect whitespace between the @ and throw.
This fixes <rdar://problem/5988388> clang ObjC rewriter: mystery 'w' inserted in exception throw.

llvm-svn: 54017
2008-07-25 15:41:30 +00:00
Steve Naroff 6c79f97037 Fix Sema::ActOnClassMessage() to pass through the identifier for "super".
This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super').

Also added a couple FIXME's since I'm not happy with my fix to Sema. It would be nicer if the super handling for class/instance messages was the same (based on PreDefinedExpr).

llvm-svn: 53994
2008-07-24 19:44:33 +00:00
Ted Kremenek 1c0c06bb9c "This patch adds paths for Fedora 9 in clang.cpp and support for two preprocessor options in ccc."
Patch by Zhongxing Xu!

llvm-svn: 53976
2008-07-24 03:49:15 +00:00
Ted Kremenek c99332c5a6 Modified HTMLDiagnostics to also perform syntax highlighting for errors in header files.
llvm-svn: 53965
2008-07-23 23:18:15 +00:00
Ted Kremenek 3b28f4911c Add prototype implementation of unused ivar check.
llvm-svn: 53942
2008-07-23 00:45:26 +00:00
Ted Kremenek 1f352db96a Moved registration of basic path-sensitive checks from GRSimpleVals.cpp to GRExprEngineInternalChecks.cpp.
llvm-svn: 53909
2008-07-22 16:21:24 +00:00
Chris Lattner 388f6e97e1 unindent this function by using an early exit, not functionality change.
llvm-svn: 53877
2008-07-21 21:33:21 +00:00
Chris Lattner 390d39ac7e move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.

llvm-svn: 53876
2008-07-21 21:32:27 +00:00
Steve Naroff f0ff879881 RewriteObjC::RewriteObjCForCollectionStmt() needs to handle bodies with a single statement.
Fixes <rdar://problem/6084870> clang ObjC rewriter: for-in enumeration in 1 line produces output with error.

llvm-svn: 53858
2008-07-21 18:26:02 +00:00
Chris Lattner d004505b74 introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.

llvm-svn: 53856
2008-07-21 18:19:38 +00:00
Daniel Dunbar 155ed24359 Prevent clang from emitting output when input has errors
+ test case
<rdar://problem/6080040>
http://llvm.org/bugs/show_bug.cgi?id=2280

llvm-svn: 53756
2008-07-18 16:38:05 +00:00
Steve Naroff 97adf60418 RewriteObjC::SynthMessageExpr(): Fix super rewrite (a fairly recent regression).
Fixes <rdar://problem/6046663> clang ObjC rewriter: Regression in handling of 'super' in latest build.

llvm-svn: 53703
2008-07-16 22:35:27 +00:00
Steve Naroff d7ebc05476 Remove a FIXME from RewriteObjC::RewriteObjCSynchronizedStmt().
llvm-svn: 53696
2008-07-16 19:47:39 +00:00
Steve Naroff 8dd1525b9a RewriteObjC::Initialize(): add function decls used by @synchronized.
This fixes <rdar://problem/6040143> clang ObjC rewriter: @synchronized keyword inserts undeclared objc functions.

llvm-svn: 53695
2008-07-16 18:58:11 +00:00
Steve Naroff de7d0f69ba Two fixes:
- Make sure ObjCIvarDecl propagates the bitfield width.
- RewriteObjC::SynthesizeIvarOffsetComputation(): Avoid using the __OFFSETOF__ mumbo jumbo for bitfields (since it isn't legal C). This fixes <rdar://problem/5986079> clang ObjC rewriter: bitfields and ivar access don't mix.

llvm-svn: 53694
2008-07-16 18:22:22 +00:00
Steve Naroff ce2dca186b RewriteObjC::RewriteObjCTryStmt():Don't synthesize a catch begin if there are 0 catch clauses.
This fixes <rdar://problem/5987211> clang ObjC rewriter: @try / @finally block produces unbalanced output.

llvm-svn: 53679
2008-07-16 15:31:30 +00:00
Steve Naroff b067bbd019 Teach RewriteObjC::RewriteObjCMethodDecl() to deal with pointer to function return types.
This fixes <rdar://problem/6034961> clang ObjC rewriter: rewriting methods with function pointer return values does not work

llvm-svn: 53678
2008-07-16 14:40:40 +00:00
Ted Kremenek fd7efdf20d Provide an "Analysis Scope" for Analyses so checks can either be run on code declarations (bodies) or Objective-C @implementation blocks.
llvm-svn: 53584
2008-07-15 00:46:02 +00:00
Ted Kremenek 3063b73773 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

llvm-svn: 53575
2008-07-14 23:41:13 +00:00
Ted Kremenek 3bfb314c25 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.

llvm-svn: 53482
2008-07-11 22:40:47 +00:00
Ted Kremenek 79ab0fa913 In a report-XXXXX.html, make the title include the name of the file with the bug. Patch by Jean-Daniel Dupas!
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002166.html

llvm-svn: 53184
2008-07-07 18:31:05 +00:00
Nuno Lopes 88b1d0ee42 add gentoo stable gcc headers path so that all tests pass here (CPATH isnt enough..)
llvm-svn: 53143
2008-07-05 17:15:18 +00:00
Ted Kremenek e66ca6f35a For the -dealloc checker, check the LangOptions to determine whether or not the code is compiled with GC.
llvm-svn: 53098
2008-07-03 14:35:01 +00:00
Ted Kremenek 1d3c797c90 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.

llvm-svn: 53081
2008-07-03 05:26:14 +00:00
Ted Kremenek 0e7d25233e Added static analysis check to see if a subclass of NSObject implements -dealloc, and whether or not that implementation calls [super dealloc].
llvm-svn: 53075
2008-07-03 04:29:21 +00:00
Ted Kremenek c7efb536d5 Unify the code path for the Dead Stores checker to always use the BugReporter interface.
llvm-svn: 53054
2008-07-02 23:16:33 +00:00
Ted Kremenek b1d0118a1a 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.

llvm-svn: 53048
2008-07-02 21:24:01 +00:00
Ted Kremenek 125d4a3b2d 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.

llvm-svn: 53046
2008-07-02 20:13:38 +00:00