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

881 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar 539ced1fdd Add dummy -ast-dump support for ObjC category implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:31:15 +00:00
Steve Naroff 22aed6574f Remove old diag that alerted the user to a limitation we no longer have:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:12:46 +00:00
Steve Naroff d3f779019c Create a function, eliminating some redundancy between SynthesizeBlockInitExpr() and SynthesizeBlockLiterals().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:06:12 +00:00
Steve Naroff acba0f2d0b Finish implementing copy/dispose helpers for imported block decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:47:37 +00:00
Daniel Dunbar b0adbba45c Set exit code properly on "Unexpected program action".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:42:49 +00:00
Steve Naroff 5e52b1763f Add indirection required for byref BlockDeclRefExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:52:47 +00:00
Steve Naroff 3b0fd64cf3 Handle bookkeeping for imported blocks (in SynthesizeBlockImpl).
This code was "lost" with my recent changes to SynthesizeBlockFunc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:00:11 +00:00
Steve Naroff b65a4f1cc2 Cut/paste error...need to use the expression "name" for member references (or other complex expressions that can embed a block pointer type)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:45:51 +00:00
Steve Naroff 8e9216dab0 Clear the map that associated the rewritten block with it's corresponding BlockExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:10:02 +00:00
Steve Naroff 70f9550c27 Moved main control flow functions to bottom of file.
Reworked control flow to:
- rewrite the block expr body "in place".
- used Chris's new rewriter hook "getRewritenText" to "lift" the text for later use.
- finally, we do the block expr text replacement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:06:23 +00:00
Steve Naroff 94ede6e443 Remove an old/vacuous if clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 23:00:50 +00:00
Steve Naroff 4e13b762e0 More fun & games with the block rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 20:28:15 +00:00
Steve Naroff 39622b9ad9 Rewrite global block expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:38:09 +00:00
Steve Naroff 83ba14e260 - Add a convenience constructor to Type.
- Many rewriter modifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:04:50 +00:00
Steve Naroff 48a8c61adb Rework SynthesizeBlockImpl() to include a constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 12:09:49 +00:00
Daniel Dunbar 1bfe1c2129 Pass postfix attributes to ActOnFields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 02:03:53 +00:00
Steve Naroff 3ad29e2542 Get the right location to insert the synthesized block literals/functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 00:12:09 +00:00
Steve Naroff a0b75cf582 Name changes and some cleanup of preamble.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 23:30:43 +00:00
Steve Naroff 8af6a451ea Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:12:56 +00:00
Daniel Dunbar e553a726fa (llvm up) If the target triple is unspecified, automatically set the
OS version part to that of the host on darwin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 01:21:33 +00:00
Daniel Dunbar 14bfdfec4e Drop code to validate OS part of target triple on darwin, too fragile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 00:26:24 +00:00
Daniel Dunbar 320a054acf Fix help for --suppress-system-warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:49:53 +00:00
Chris Lattner 079f2c467d Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:30:12 +00:00
Chris Lattner ba0f25f754 Finish handling of -mmacosx-version-min. If you now do something like:
clang -mmacosx-version-min=10.4.9 ...

you'll end up with a target triple like "i686-apple-darwin8.9".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:16:56 +00:00
Chris Lattner 6a30c1fc7f start handling 'mmacosx-version-min', this is not complete yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 01:13:12 +00:00
Chris Lattner 0b9e736308 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:18:42 +00:00
Chris Lattner 1b9ad143c1 fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 20:05:14 +00:00
Daniel Dunbar fd96684034 Make clang preprocessed output a bit more like gcc output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 01:13:35 +00:00
Steve Naroff cc2ece2e36 Fix a couple harmless warnings when compiling optimized with gcc (reported by mrs@apple.com).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 22:46:45 +00:00
Steve Naroff 1f6c3aebff Fix some const-ness to keep the VisualStudio C++ compiler happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 17:22:34 +00:00
Steve Naroff ca3bb4f14f RewriteBlocks::RewriteBlockPointerDecl(): Handle TypedefDecl's and VarDecl's uniformly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:15:53 +00:00
Steve Naroff eab5f63207 Teach block rewriter to replace '^' with '*' in VarDecls.
Since we don't have DeclGroup's and location information for types, there is some fancy footwork to do this fairly reliably.

O.K...it's a kludge. One day, we can use this as motivation to do this more gracefully:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 19:24:41 +00:00
Ted Kremenek cfdf9b4edf Change implementation of NSError** coding-style check to be invoked at the end of the retain/release analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 21:25:13 +00:00
Steve Naroff 1318895690 Add driver support for invoking block rewriter.
Also tweaked the create function to take an explicit output file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 14:10:13 +00:00
Ted Kremenek f45d18c08b Implemented one of the checks requested in PR 2600:
"Method accepting NSError** argument should have non-void return value to indicate that an error occurred."

Test case written, but the header needs to be delta-debugged reduced.  Will commit shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 06:33:41 +00:00
Steve Naroff 9c3c902835 Remove BlockStmtExpr.
Block literals are now represented by the concrete BlockExpr class.
This is cleanup (removes a FIXME).
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 18:37:59 +00:00
Steve Naroff 1c9f81b902 Add support for rewriting blocks...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 00:13:27 +00:00
Ted Kremenek a95d375044 Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 05:16:45 +00:00
Daniel Dunbar 2fe0997427 Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
 - Currently also enables the behavior that allows silent redefinition
   of types in system headers. Conceptually these are separate but I
   didn't feel it was worth two options (or changing LangOptions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 18:10:20 +00:00
Steve Naroff 378f47afee Fix <rdar://problem/6210791> clang ObjC rewriter: @try / @catch block with no @finally does not call objc_exception_try_exit.
Need a couple tweaks to RewriteObjCTryStmt(). Need to deal with implicit finally clauses (to make sure objc_exception_try_exit is called). Also fixed a related bug where we need to generate an implicit @catch else clause (to again make sure objc_exception_try_exit is called).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 15:29:03 +00:00
Argyrios Kyrtzidis d146552a1e LangOptions.C99 should be false in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:21:06 +00:00
Douglas Gregor 233f74b29b Add support for expected-note to Clang's -verify option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 02:46:36 +00:00
Steve Naroff 8bd3dc64d2 Fix <rdar://problem/6197841> try, finally with no catch stops the exception from being propagated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 19:59:12 +00:00
Nico Weber e275e926b3 rename libclangSEMA to libclangSema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-07 17:09:06 +00:00
Ted Kremenek 4b7c98378a Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:

    typedef struct { ... } x;  

  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 17:16:31 +00:00
Daniel Dunbar 737bdb418c Workaround gcc bug causing crash on our preprocessed outputs.
- gcc is not happy if we start a preprocessed file with
#line 1 "XXX" 1
 - Workaround by making sure file starts with a simple #line change.

Also, factored WriteLineInfo out.

Also, fixed bug where FileType was not being correctly updated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 03:22:57 +00:00
Ted Kremenek df042e6c2b Remove "NextDecl" from RecordDecl. This change touches many files that where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 01:34:33 +00:00
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