Commit Graph

285 Commits

Author SHA1 Message Date
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
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 f992cfb4ab 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).

llvm-svn: 53041
2008-07-02 18:23:21 +00:00
Ted Kremenek bdbe6130f4 Move -dump-live-variables logic to AnalysisConsumer.
llvm-svn: 53039
2008-07-02 18:11:29 +00:00
Ted Kremenek becec2cbbc Move logic for "-checker-simple" to the new AnalysisConsumer interface.
llvm-svn: 53028
2008-07-02 16:35:50 +00:00
Ted Kremenek 8e631a0267 Migrated driver logic for running the CF retain/release checker over to the new AnalysisConsumer interface.
llvm-svn: 53002
2008-07-02 00:44:58 +00:00
Ted Kremenek f0413bfcda Added AnalysisConsumer, a meta-level ASTConsumer class to drive various
analyses. This potentially is the primordial origins of a Clang-equivalent
"PassManager".

The new AnalysisConsumer interface allows multiple analyses to be run from a
single invocation of Clang.

Migrated the logic of "-warn-dead-stores" and "-warn-uninit-values" to use the
new AnalysisConsumer interface. The new interface results in a significant code
reduction to incorporate an analysis into the Driver.

Updated a test case to (correctly) acknowledge that it contains a dead store
(this check wasn't being performed because it was previously masked by
-warn-uninit-values).

llvm-svn: 52996
2008-07-02 00:03:09 +00:00
Matthijs Kooijman 0fb56e50b1 Make clang work on 32 bit powerpc linux.
Patch by Nick Lewycky!

llvm-svn: 52777
2008-06-26 08:39:30 +00:00
Ted Kremenek 675a6e6dfa Patch by Anders Bergh:
'There's not much to say about this patch, it just adds the Arch Linux
gcc 4.3.1 header paths for i686 and amd64. The patch was generated
using "svn diff" with clang at revision 52660. The paths aren't
distribution-specific, so they should work for all Linux distributions
using the default(?) names like "i686-pc-linux-gnu".'

llvm-svn: 52665
2008-06-24 03:33:47 +00:00
Argyrios Kyrtzidis 351008da17 Allow -parse-noop -verify options to be used together.
llvm-svn: 52249
2008-06-13 12:15:34 +00:00
Ted Kremenek 92611db88f Use a common SourceManager when processing multiple files. This allows us to cache the contents of source files already loaded from disk.
llvm-svn: 52066
2008-06-06 22:42:39 +00:00
Ted Kremenek 3ad519441f Fix crash when running with multiple source files. This can be improved.
llvm-svn: 52032
2008-06-06 01:47:30 +00:00
Ted Kremenek b147ad1051 Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.
llvm-svn: 51943
2008-06-04 15:55:15 +00:00
Ted Kremenek a3774667d3 Correctly preserve the order between -F and -I options.
llvm-svn: 51803
2008-05-31 00:27:00 +00:00
Ted Kremenek 6bb6d9f197 Use llvm:🆑:desc for description of the -Wimplicit-function-declaration option.
Patch by Holger Schurig!

llvm-svn: 51774
2008-05-30 16:42:02 +00:00
Chris Lattner 8c80070de2 Implement support for -w, which silences all warnings. PR2384.
llvm-svn: 51683
2008-05-29 15:36:45 +00:00
Ted Kremenek 0954b4564e Update driver include paths to work on darwin10.
llvm-svn: 51431
2008-05-22 15:26:22 +00:00
Chris Lattner 664ef65981 make #if 0 code compile, even though it still isn't very useful.
llvm-svn: 50920
2008-05-09 22:43:24 +00:00
Sanjiv Gupta 15cb669039 Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.
llvm-svn: 50848
2008-05-08 08:54:20 +00:00
Sanjiv Gupta cd13ef01a2 Remove the ending "." from clang options descriptions.
llvm-svn: 50847
2008-05-08 08:28:14 +00:00
Chris Lattner 3c04ff00c2 start implementation of a macro rewriter, this is currently just stubbed out.
llvm-svn: 50845
2008-05-08 06:52:13 +00:00
Chris Lattner 00e2607de2 Add support for -Wimplicit-function-declaration, rdar://5907433
llvm-svn: 50672
2008-05-05 21:18:06 +00:00
Chris Lattner de977c0a5c Fix PR2281: these two warnings should be promoted to error on
pedantic error.  Perhaps I should add a class of 'extension' that is
'extension that warns by default', which would be cleaner.

llvm-svn: 50633
2008-05-04 23:52:02 +00:00
Ted Kremenek 4d1f422c6f Provide the option to run the CF-retain checker in GC enabled mode.
The transfer functions for the checker don't do anything special yet in GC mode.

llvm-svn: 50394
2008-04-29 05:13:59 +00:00
Ted Kremenek d796c18d7b Add -fobjc-gc and -fobjc-gc-only options to the driver.
Add corresponding enum in LangOptions.

llvm-svn: 50387
2008-04-29 04:37:03 +00:00
Ted Kremenek 467297ab48 TranslationUnit now owns IdentifierTable, TargetInfo, and Selectors objects
when it is constructed via deserialization.  This is done by recording a flag
indicating that this is the case, and it deletes these objects by getting
the references stored in the ASTContext object.  This fixes some memory
leaks that occurs when we deserialize translation units from bitcode files.

The rationale between having TranslationUnit sometimes own these objects and
sometimes not is that a TranslationUnit object can be constructed from
state generated by the parser (Preprocessor; semantic analyzer, etc.), and thus
in these cases won't own the IdentifierTable or Selectors, etc.  During
deserialization, there is no Preprocessor, so somebody needs to own these
objects in order for them to be properly reclaimed.

llvm-svn: 50149
2008-04-23 16:25:39 +00:00
Chris Lattner 1a44f7fce9 simplify the return of InitializePreprocessor to be bool instead of a fileid
llvm-svn: 49974
2008-04-19 23:25:44 +00:00
Chris Lattner ba1f37bfdf simplify ownership of the predefines buffer.
llvm-svn: 49973
2008-04-19 23:09:31 +00:00
Ted Kremenek f42f3fb47d class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.

llvm-svn: 49875
2008-04-17 22:31:54 +00:00
Ted Kremenek 306492d8cb Generate the Preprocessor using a local PreprocessorFactory object.
While this adds no extra functionality now, we will soon pass the
PreprocessorFactory object to some ASTConsumers.

llvm-svn: 49873
2008-04-17 21:38:34 +00:00
Ted Kremenek 2e4d0ecaa3 Added fixme.
llvm-svn: 49797
2008-04-16 16:53:18 +00:00
Ted Kremenek f2e6fcf3bf Hook up HTMLDiagnostics to use Chris's new syntax highlighting. --html-diags
currently doesn't pass in the Preprocessor from the driver, so we don't get
syntax highlighting when we create HTMLDiagnostics in that way.

llvm-svn: 49796
2008-04-16 16:39:56 +00:00
Chris Lattner 060d8aa2ed Add a mode of hackily syntax highlighting comments. This has a number of
problems, including the fact that it doesn't work well with multi-line 
comments due to Ted's crazy table.  However, that could be fixed, and it
does work with single-line ones :).

llvm-svn: 49778
2008-04-16 06:11:58 +00:00
Chris Lattner dffe0f7db5 Add -o support for -emit-html, make it not produce a file on an error.
llvm-svn: 49777
2008-04-16 05:21:09 +00:00
Ted Kremenek 088d12e741 Remove "--html-test" driver option and its corresponding code; all of this
functionality has been migrated into "--emit-html" and "--html-diags".

llvm-svn: 49776
2008-04-16 04:38:45 +00:00
Steve Naroff 1dc53ef494 Rename RewriteTest->RewriteObjC.
llvm-svn: 49692
2008-04-14 22:03:09 +00:00
Ted Kremenek 751d4d2d60 Added driver option "-checker-opt-analyze-headers" to force the static
analyzer to analyze functions declared in header files.

llvm-svn: 49675
2008-04-14 18:40:58 +00:00
Sam Bishop cb1a37b145 Handle -D and -U options in order, so that they can cancel each other out when
intermixed.

llvm-svn: 49645
2008-04-14 14:41:57 +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
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 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
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 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
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 216624ce58 Initial experimentation with adding boxed "annotations" to HTMLized source.
llvm-svn: 48540
2008-03-19 07:53:42 +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
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