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

834 Коммитов

Автор SHA1 Сообщение Дата
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
Ted Kremenek ea644d8440 Following gcc's behavior, only enable trigraphs if '-trigraphs' or '-ansi' is
specified, or -std is set to a conforming mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:22:16 +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
Daniel Dunbar 9f0afd4e79 Rename ObjCPropertyImplDecl::PropertyImplKind (consistency)
- Change enum name to Kind.
 - Change enum constants to English strings.

Also, fix getPropertyImplementation (which probably should be renamed)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 04:47:31 +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
Chris Lattner 405674c26c adjust to changes in various APIs from LLVM. We can't print
an APInt directly to an ostream now, so add some hacks.  It would
be better to switch all of the bugreport (and friends) stuff over
to raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:37 +00:00
Daniel Dunbar dcb4a1a6dd Add TargetInfo::useNeXTRuntimeAsDefault
- Used to autoselect runtime when neither -fnext-runtime nor
   -fgnu-runtime is specified.
 - Default impl is false, all darwin targets set it to true.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 08:43:39 +00:00
Nico Weber 0fca022d77 Move most of HeaderSearch initialization to libDriver.
For example, adding the default system include paths in clients is now as
simple as

  InitHeaderSearch init(headers);
  init.AddDefaultSystemIncludePaths(langopts);
  init.Realize();



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 09:25:22 +00:00
Chris Lattner efe8a96f59 improve pretty printing of objc method declaration,
patch contributed by Benjamin Stiglitz!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55170 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 06:59:15 +00:00
Steve Naroff 3498cc9793 RewriteObjC::RewriteObjCSynchronizedStmt(): Make sure the sync expr is cast to "id".
This fixes <rdar://problem/6163088> clang ObjC rewriter: @synchronized ([foo class]) {} does not cast properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55118 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 13:03:03 +00:00
Steve Naroff c7089f1be9 Fix crasher in RewriteObjC::RewriteObjCSynchronizedStmt(). Can't depend on the source locations of the sync expression (since it may have been rewritten.
Fixes <rdar://problem/6156363> clang ObjC rewriter: rewriting attached file causes assertion failure: invalid FileID


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 13:04:19 +00:00
Chris Lattner e9d89d886a Use raw_ostream to output an unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 04:23:15 +00:00
Argyrios Kyrtzidis 0835a3cdee Add ExplicitCastExpr to replace the current CastExpr, and have ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr):
Expr
  -> CastExpr
     -> ExplicitCastExpr
     -> ImplicitCastExpr 

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 23:01:59 +00:00
Chris Lattner 653201b7d2 printing with an unspecified dest means to print to stdout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:09:08 +00:00
Chris Lattner 76b3a72f78 don't delete a variable on the stack
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:07:01 +00:00
Chris Lattner 202e9ac1b1 simplify this code a bit more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 03:54:39 +00:00
Chris Lattner e96de3e913 remove global variables for output stream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 03:12:02 +00:00
Chris Lattner dceb6a7244 Switch to shared raw_ostream code instead of having it be clang specific.
This also helps the eventual distcc project.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 01:47:12 +00:00
Ted Kremenek a9bc2d98a2 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 03:45:07 +00:00
Daniel Dunbar f77ac86f4e Add LangOptions::NeXTRuntime.
- Wired to -fnext-runtime and -fgnu-runtime options.
 - Defaults to GNU, no autoselection for NeXT.

Emit NeXT OBJC_IMAGE_INFO marker.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 21:35:06 +00:00
Daniel Dunbar 6379a7a153 Add -fexceptions to Driver
- Maps to LangOptions.Exceptions
 - Currently always off, should autoselect based on language.

Update CodeGen to set unwind attribute on functions definitions based
       on LangOptions.Exceptions.
 - Still need to set attributes appropriately on calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 17:36:14 +00:00
Daniel Dunbar e91593ef08 More #include cleaning
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and
   SourceLocation.h)
 - Move ASTContext constructor into implementation


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 04:54:23 +00:00
Nico Weber 7bfaaaecb3 * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now  
  empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of  
  warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on  
  TextDiagnostic
* some code duplication is removed




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:59:06 +00:00
Nico Weber be1eb5c919 Do not crash with -serialize.
This happened because seralization was done in the constructor, and at that time the TranslationUnit is no longer valid.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:20:05 +00:00
Chris Lattner d9f6910f4e rename PreDefinedExpr -> PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 01:53:14 +00:00
Nico Weber dae86966bb do not serialize invalid asts. this fixes bug #2637
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 18:32:11 +00:00
Ted Kremenek e452e0ffc8 Unbreak SerializationTest and the Rewriter by doing the work in HandleTranslationUnit instead of the destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:15:52 +00:00
Ted Kremenek 7e7e6253d4 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 02:46:37 +00:00
Ted Kremenek 57134339c8 Remove unneeded #includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 18:14:04 +00:00
Ted Kremenek 7a08e289b2 Micro cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 18:13:12 +00:00
Ted Kremenek b4398aa27d Fix --html-diags in driver by delaying the construction of an HTMLDiagnosticClient until after we have created the Preprocessor object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 17:49:57 +00:00
Matthijs Kooijman 992a8786f2 Let LLVMCodeGenWriter forward all the methods defined in ASTConsumer, to
prevent unexpected surprises later on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 16:04:15 +00:00
Steve Naroff aba49d10da 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 15:58:23 +00:00
Nico Weber fd54ebcaaf add a libDriver, for now only move the text diangostics stuff from Driver to there
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 23:33:20 +00:00
Steve Naroff 88bee74513 Finish fixing <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 20:04:48 +00:00
Nuno Lopes db82568300 fix crash when printing diagnostics with tokens that span through more than one line
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 19:40:20 +00:00
Ted Kremenek 815c78fd9a 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:50:11 +00:00
Steve Naroff a11440b68a Fix <rdar://problem/6108119> clang ObjC rewriter: if no newline at end of input file, rewriter inserts #define on same line as closing brace
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54363 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:47:23 +00:00
Daniel Dunbar 914701ed49 Move AsmLabel into Declarator instead of just a parameter to
ActOnDeclarator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 16:28:08 +00:00
Daniel Dunbar a80f8749f2 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...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 01:35:17 +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
Daniel Dunbar bb8f4e69c3 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-01 00:41:12 +00:00
Ted Kremenek ae8a25591d Fix regression in range highlighting in HTML output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 23:35:38 +00:00
Steve Naroff 4f95b75053 Fix incomplete implementation for rewriting protocol refs.
<rdar://problem/6108127> clang ObjC rewriter: no translation of id <proto>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 18:15:38 +00:00
Chris Lattner 8b51fd7631 remove some unneeded calls to getCanonicalType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 22:36:27 +00:00
Chris Lattner a59e05070b comment out #pragma mark and #warning directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 16:37:06 +00:00
Chris Lattner 0d76fcde92 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54019 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 16:29:12 +00:00
Steve Naroff 4ba0acbe83 Fix RewriteObjC::RewriteObjCThrowStmt() to respect whitespace between the @ and throw.
This fixes <rdar://problem/5988388> clang ObjC rewriter: mystery 'w' inserted in exception throw.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 15:41:30 +00:00
Steve Naroff fc93d52ada 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 19:44:33 +00:00
Ted Kremenek 1683360500 "This patch adds paths for Fedora 9 in clang.cpp and support for two preprocessor options in ccc."
Patch by Zhongxing Xu!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 03:49:15 +00:00
Ted Kremenek fd8fc4ee5c Modified HTMLDiagnostics to also perform syntax highlighting for errors in header files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 23:18:15 +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
Chris Lattner 9d0aaa11cd unindent this function by using an early exit, not functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:33:21 +00:00
Chris Lattner 780f329cb0 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:32:27 +00:00
Steve Naroff 600e4e8c35 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:26:02 +00:00
Chris Lattner 3db6cae19c introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:19:38 +00:00
Daniel Dunbar c8aeb655c3 Prevent clang from emitting output when input has errors
+ test case
<rdar://problem/6080040>
http://llvm.org/bugs/show_bug.cgi?id=2280


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53756 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 16:38:05 +00:00
Steve Naroff f616ebb9b6 RewriteObjC::SynthMessageExpr(): Fix super rewrite (a fairly recent regression).
Fixes <rdar://problem/6046663> clang ObjC rewriter: Regression in handling of 'super' in latest build.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 22:35:27 +00:00
Steve Naroff b2a39459f5 Remove a FIXME from RewriteObjC::RewriteObjCSynchronizedStmt().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 19:47:39 +00:00
Steve Naroff 59f05a48a7 RewriteObjC::Initialize(): add function decls used by @synchronized.
This fixes <rdar://problem/6040143> clang ObjC rewriter: @synchronized keyword inserts undeclared objc functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 18:58:11 +00:00
Steve Naroff 8f3b2654a9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 18:22:22 +00:00
Steve Naroff c9ba172447 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 15:31:30 +00:00
Steve Naroff 76e429d781 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53678 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 14:40:40 +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 f6f593fae2 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:31:05 +00:00
Nuno Lopes 68bf387296 add gentoo stable gcc headers path so that all tests pass here (CPATH isnt enough..)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 17:15:18 +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
Ted Kremenek f4381fddf1 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:03:09 +00:00
Matthijs Kooijman e9484fc09a Make clang work on 32 bit powerpc linux.
Patch by Nick Lewycky!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 08:39:30 +00:00
Matthijs Kooijman 72be34febc Link in LLVMAnalysis after LLVMCodeGen, since the latter depends on the former
since LLVM r52748.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 08:37:29 +00:00
Chris Lattner 550b8db03c a temporary minimal hack to get clang building after the getStringValue changes in llvm mainline.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52753 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:05:20 +00:00
Ted Kremenek d88fb6c424 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".'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 03:33:47 +00:00
Chris Lattner 23a0e45540 Implement printing for ObjCClassDecl's, patch by Jean-Daniel Dupas!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 21:40:20 +00:00
Chris Lattner 0d17f6f7b1 Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:04:54 +00:00
Ted Kremenek 354840eec2 Updated call to dead stores to use proper arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:55:29 +00:00
Chris Lattner 4111024be8 Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:05:57 +00:00
Argyrios Kyrtzidis 14d4140de1 Allow -parse-noop -verify options to be used together.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 12:15:34 +00:00
Argyrios Kyrtzidis 39ba4aeca2 -Changes to TagDecl:
Added TagKind enum.
  Added getTagKind() method.
  Added convenience methods: isEnum(), isStruct(), isUnion(), isClass().
-RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 23:19:58 +00:00
Eli Friedman d8a65c16bb Get -serialize working again, plus a bit of minor cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 20:02:51 +00:00
Ted Kremenek c0c03bc3c4 Use a common SourceManager when processing multiple files. This allows us to cache the contents of source files already loaded from disk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 22:42:39 +00:00
Ted Kremenek c68ecb5724 Fix crash when running with multiple source files. This can be improved.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52032 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 01:47:30 +00:00
Ted Kremenek e7d07d1136 Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 15:55:15 +00:00
Chris Lattner 1a78735ade make rewrite macros insert a space when commenting out macros where the token didn't
lead with a space.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 06:10:17 +00:00
Steve Naroff 73ebd6d33d Fix <rdar://problem/5976164> clang ObjC rewriter: for ... in enumeration inserts undeclared function (objc_enumerationMutation should be in preamble)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 20:23:21 +00:00
Chris Lattner 8ea78e6e57 Two identifiers are not the same unless they have the same identifier info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 22:01:01 +00:00
Ted Kremenek e3a6198400 Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).

Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls.  This is a workaround for: <rdar://problem/5966749>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 20:11:04 +00:00
Steve Naroff baf58c3f1f Fix <rdar://problem/5917992> clang ObjC rewriter: #end from #if statement lost in translation.
Some fancy footwork to accommodate embedded preprocessor directives within an interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 14:15:04 +00:00
Steve Naroff 6cafbf2a67 Fix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously commented out
This fix involved tightening up needToScanForQualifiers(), which predated ObjCQualifiedIdType.
It also includes a minor tweak to the code that searches for the beginning of the qualified type. If the AST contained the correct beginning of the declaration (i.e. the beginning of the declaration specifiers), this code would be more robust. Since it doesn't, we apply an adhoc heuristic. Note that DeclSpec contains this info...we just don't propagate it to the AST (at present).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 05:02:17 +00:00
Steve Naroff 7691d9b77b Hack RewriteObjC::RewriteObjCStringLiteral() to include the filename in the generated code (replacing any non-alphanumeric characters with "_"). This allows header files to contain ObjCStringLiterals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 03:35:42 +00:00
Ted Kremenek f372111960 Correctly preserve the order between -F and -I options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 00:27:00 +00:00
Ted Kremenek 358256def0 Use llvm:🆑:desc for description of the -Wimplicit-function-declaration option.
Patch by Holger Schurig!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 16:42:02 +00:00
Eli Friedman 9b5239339d Fix crash with -serialize (reported to cfe-dev). The issue was
essentially that we were destroying the declarations twice.

(Note that we don't use -serialize directly in the testsuite, only 
SerializeTest.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 11:28:30 +00:00
Chris Lattner 5b4681c8ef Implement support for -w, which silences all warnings. PR2384.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 15:36:45 +00:00
Chris Lattner 8d36616a09 give location info to another paren expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 16:38:23 +00:00
Chris Lattner 3b2c58ce3b minor changes, collect the range of an expr before rewriting the subexprs
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51497 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 20:40:52 +00:00
Steve Naroff 1a2b90d081 Make sure method definitions get output with -ast-dump.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 18:50:58 +00:00
Ted Kremenek 1d3cce3e1c Update driver include paths to work on darwin10.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 15:26:22 +00:00
Dan Gohman 63e2dcc828 Explicitly #include Support/Streams.h when using llvm::cout and friends.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51391 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 20:19:16 +00:00
Eli Friedman 5f1adf8fb4 Fix the destruction "properly" in the sense that we actually destroy the
ASTs.  This is a hack, but I haven't considered how we really 
want to do this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 05:33:10 +00:00
Steve Naroff 73b17cd017 Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C".
Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 21:12:10 +00:00
Chris Lattner ec92156040 Implement -rewrite-macros, which is a crazy macro expander that expands
macros but doesn't expand #includes, remove comments, remove #defines
etc.

For example:

----
#include <stdio.h>

#define bbaa
#define funclike(x) x "a" x "b" x

bbaa  bbaa

#if 1 
funclike("gar")
foo /*blah*/  bar
bar
#endif

#if 0
funclike()
#endif
----


rewrites to:

----
#include <stdio.h>

#define bbaa
#define funclike(x) x "a" x "b" x 

/*bbaa  bbaa*/

#if 1
 "gar" "a" "gar" "b" "gar"/*funclike*//*("gar")*/
foo /*blah*/  bar
bar
#endif

#if 0
/*funclike()*/
#endif
----


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50925 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-10 00:02:33 +00:00
Chris Lattner 0951052064 make #if 0 code compile, even though it still isn't very useful.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 22:43:24 +00:00
Steve Naroff 580ca78593 Fix <rdar://problem/5924225> clang ObjC rewriter: objc_exception_throw declaration in preamble does not match objc/objc-exception.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50915 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 21:17:56 +00:00
Steve Naroff 1284db8d85 Make sure the prototype for objc_msgSend_fpret() returns a double.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 22:02:18 +00:00
Steve Naroff f07576130b Fix <rdar://problem/5879237> clang objc rewriter: ivars not accessible in structure generated for class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 17:52:16 +00:00
Sanjiv Gupta e8b9f5b8ea 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50848 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 08:54:20 +00:00
Sanjiv Gupta 56cf96b3ea Remove the ending "." from clang options descriptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50847 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 08:28:14 +00:00
Chris Lattner b57e3d47c3 start implementation of a macro rewriter, this is currently just stubbed out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 06:52:13 +00:00
Steve Naroff 5df5b76594 Fix <rdar://problem/5887874> clang ObjC rewriter: Use a different name for 'offsetof' macro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 21:23:49 +00:00
Fariborz Jahanian 33de3f0333 This patch introduces declaration of getter methods for ObjC2's
properties. Couple of property tests will fail with this patch.
Will fix them next.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 17:43:59 +00:00
Steve Naroff 1919032c9b Fix <rdar://problem/5908598> clang ObjC rewriter: typo in #pragma at end
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 00:06:16 +00:00
Ted Kremenek ea17d6afef Improve HTMLDiagnostics by understanding the "Below" hint.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 23:42:18 +00:00
Steve Naroff 9f525970be Fix <rdar://problem/5879237> clang objc rewriter: ivars not accessible in structure generated for class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 23:20:07 +00:00
Fariborz Jahanian b89ca237a7 Print ObjC methods of ObjC classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 23:14:25 +00:00
Steve Naroff 69c827f948 Fix <rdar://problem/5888515> clang ObjC rewriter: Use objc.h for declarations instead of putting them in the preamble?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 22:45:19 +00:00
Steve Naroff fbfe82527d Fix <rdar://problem/5881225> clang ObjC Rewriter: Protocol structure defined twice when two interfaces use it in same file
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 18:26:51 +00:00
Fariborz Jahanian 5251e130a2 Patch to refactor setter/getter names of property attributes into Selector
(was IdentifierInfo * before). This will make method declartations whole
lot easier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 18:09:04 +00:00
Chris Lattner 37d1084efc Add support for -Wimplicit-function-declaration, rdar://5907433
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 21:18:06 +00:00
Fariborz Jahanian 46b55e56d0 percolate @optional/@required protocols down to ASTs for
properties declared in the protocol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:51:55 +00:00
Chris Lattner 8aedf199e9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50633 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 23:52:02 +00:00
Ted Kremenek 7a4648df32 Output better paths to display in bug reports and compute a common
prefix for all files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 22:04:53 +00:00
Ted Kremenek 9f7416138b When running the reference count checker twice (GC and non-GC mode), only emit
basic warnings (dead stores, null dereferences) on the first pass.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 18:01:49 +00:00
Ted Kremenek 072192bcbb added preliminary diagnostics in scan-build results to denote whether
a CF memory leak occurred with GC enabled, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 23:47:44 +00:00
Ted Kremenek e5c30122ca 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:13:59 +00:00
Ted Kremenek 01d9dbf4ae Add -fobjc-gc and -fobjc-gc-only options to the driver.
Add corresponding enum in LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 04:37:03 +00:00
Ted Kremenek 7fc89572d1 Better handling for directory names in HTML diagnostics. Work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 23:37:03 +00:00
Ted Kremenek c1e9dea3d9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 16:25:39 +00:00
Fariborz Jahanian 628b96f34e Patch to build AST for property implementation declarations and
to print declaration from its AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 00:06:01 +00:00
Ted Kremenek 5585114307 PathDiagnosticClients now retain ownership of passed PathDiagnostics, requiring
them to not be stack-allocated.

HTMLDiagnostics now batches PathDiagnostics before emitting HTML in its dtor.
This is a workaround for a problem when we trampled the Preprocessor state
when highlighting macros (sometimes resulting in an assertion failure).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 16:15:03 +00:00
Ted Kremenek 7414dc0573 html::EscapeText (using the Rewriter) now replaces tabs by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 01:02:33 +00:00
Chris Lattner 51574ea138 simplify the return of InitializePreprocessor to be bool instead of a fileid
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 23:25:44 +00:00
Chris Lattner aa39197431 simplify ownership of the predefines buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 23:09:31 +00:00
Steve Naroff fa8ec62bf0 Remove bogus cast (<rdar://problem/5874848> clang objc-rewriter: structure with list of protocols has wrong cast).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49935 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 22:15:15 +00:00
Steve Naroff 84472a897a Implement FIXME discoved by <rdar://problem/5874876> Rewriter: Explicit ivar refs outside a method are being rewritten
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 21:55:08 +00:00
Steve Naroff 543409e200 Fix <rdar://problem/5874697> Rewriter: method arguments with complex types not being rewritten properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49925 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 21:13:19 +00:00
Ted Kremenek bef5c8bf65 Restore macro expansion for HTMLPrint by using the original Preprocessor.
This is a workaround until we figure out why a freshly create Preprocessor
doesn't expand macros from headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49897 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:35:23 +00:00
Ted Kremenek 12fc014c04 Fixed range highlighting bug in HTML diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:01:33 +00:00
Ted Kremenek 339b9c2775 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 22:31:54 +00:00
Chris Lattner 1ee8d6ffab Handle text escaping (e.g. & -> &amp;) last, to avoid interactions between 'replace' operations and insert operations. This fixes a problem with "&;&" on line 666 of the gcc.c example I sent out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 22:24:51 +00:00
Ted Kremenek a42cf2e309 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 21:38:34 +00:00
Ted Kremenek 9e8829be92 Temporarily disable macro expansion in the HTML output of HTMLDiagnostics to
avoid corrupting Preprocessor state.  Working on a fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:39:57 +00:00
Ted Kremenek b747814895 HAve HTMLDiagnostics use html::HighlightRange to highlight message ranges.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:37:23 +00:00
Fariborz Jahanian 3dd4ba4068 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:25:18 +00:00
Nate Begeman 165b954fb2 Allow redirecting text diagnostic printer output to any llvm::OStream, rather
than hard coding llvm::cerr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49860 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:06:57 +00:00
Argyrios Kyrtzidis ef17782010 Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 14:40:12 +00:00
Fariborz Jahanian 7e7e3872b5 This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:08:45 +00:00
Ted Kremenek a760f5f7dc Added fixme.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49797 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 16:53:18 +00:00
Ted Kremenek 47abe76904 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49796 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 16:39:56 +00:00
Chris Lattner c54d50a418 split syntax highlighting of macros from keywords and comments,
allowing us to use a cheaper means to highlight keywords and making
it so that comments won't foul up macro expansions.

Start highlighting macro expansions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:32:08 +00:00
Chris Lattner 3245a0a1c7 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 :).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:11:58 +00:00
Chris Lattner 8ac661c3c5 Add -o support for -emit-html, make it not produce a file on an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 05:21:09 +00:00
Ted Kremenek fdbe6799ca Remove "--html-test" driver option and its corresponding code; all of this
functionality has been migrated into "--emit-html" and "--html-diags".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:38:45 +00:00
Chris Lattner b9bc3eca21 speed up -emit-html in a release build by 6.5% by avoiding std::string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 03:46:57 +00:00
Steve Naroff 248a753f6b Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 22:42:06 +00:00
Ted Kremenek 4b0f81323b For HTML diagnostics, output more information about a bug report.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 21:25:08 +00:00
Ted Kremenek 24bd3c4484 Handle "__private_extern__" storage class when printing FunctionDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 03:57:09 +00:00
Fariborz Jahanian 1de1e74541 New AST representation for each objc2's property declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49699 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 23:36:35 +00:00
Steve Naroff 0d4e963074 Remove bogus token...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 22:53:48 +00:00
Steve Naroff 8beca118bc Rename a file and update the Xcode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 22:05:54 +00:00
Steve Naroff b29b427fa9 Rename RewriteTest->RewriteObjC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 22:03:09 +00:00
Steve Naroff e93705f340 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:39:16 +00:00
Ted Kremenek cf7e958483 Use isFromMainFile instead of comparing FileIDs directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:24:13 +00:00
Ted Kremenek 080c40b192 Use SourceManager::isFromMainFile()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:14:41 +00:00
Ted Kremenek 3004be018c Convert over to new SourceManager::isFromMainFile() instead of doing direct
FileID comparison (fixes insidious corner case with chunks).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:14:03 +00:00
Ted Kremenek 5dd004125a HTMLDiagnostics now uses the new "getCanonicalID()", "isFromMainFileID()" methods from
SourceManager when doing HTML pretty-printing.  This resolves an insidious bug when
presenting error reports that only occurred in large source files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:06:04 +00:00
Ted Kremenek 55af98c10a Added driver option "-checker-opt-analyze-headers" to force the static
analyzer to analyze functions declared in header files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49675 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 18:40:58 +00:00
Sam Bishop 1102d6bd49 Handle -D and -U options in order, so that they can cancel each other out when
intermixed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 14:41:57 +00:00
Fariborz Jahanian dae1a1a2aa AST generation for objc2's property declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49565 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 23:40:25 +00:00
Chris Lattner 8808f0020f Fix rdar://5843510 don't assert and die when an invalid output
file is specified, print a happy little error message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49518 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 06:14:11 +00:00
Ted Kremenek 3ea0b6a087 Fix some bonehead bugs in summary generation in CFRefCount.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 22:58:08 +00:00
Ted Kremenek d71ed26dd8 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 22:16:52 +00:00
Ted Kremenek f5749aa30b For -emit-html, use the Rewriter to expand tabs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 23:25:54 +00:00
Ted Kremenek fa5be36172 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 22:37:58 +00:00
Ted Kremenek dab4ead083 Improve range highlighting in HTMLDiagnostic to correctly highlight ranges
that span multiple lines by inserting multiple "</span>" and "<span>" tags.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 21:29:14 +00:00
Chris Lattner 06767518f5 silence some warnings when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 05:52:18 +00:00
Chris Lattner 0442108783 Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 04:40:51 +00:00
Chris Lattner 5db17c9b5e Fix rdar://5846705: "clang -E foo.c -o foo.i" should remove foo.i on error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 04:16:20 +00:00
Chris Lattner b048c98359 This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:47:34 +00:00
Chris Lattner d658b562e8 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-05 06:32:51 +00:00
Steve Naroff b10f273eb6 Avoid implicitly including any header files (requested by ckane).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 22:58:22 +00:00
Steve Naroff c5e3277124 Rewrite @package (an ObjC 2.0 idiom).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49238 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 22:34:24 +00:00