Commit Graph

3879 Commits

Author SHA1 Message Date
Ted Kremenek 4e81c3ccac Allow two codepaths for PathDiagnostic generation. This patch mainly consists of
refactoring to make this possible (no functionality change).

llvm-svn: 68141
2009-03-31 20:22:36 +00:00
Douglas Gregor b046ffb002 Some cleanup and renaming. No functionality change
llvm-svn: 68140
2009-03-31 20:22:05 +00:00
Daniel Dunbar a207254f94 Driver: Add extra parameters for help text to option definitions.
- Currently unused.

And yes, now may be about the time I want a TableGen backend.

llvm-svn: 68139
2009-03-31 20:12:05 +00:00
Douglas Gregor aa59489b18 Implement template instantiation for template names, including both
template template parameters and dependent template names. For
example, the oft-mentioned

  typename MetaFun::template apply<T1, T2>::type

can now be instantiated, with the appropriate name lookup for "apply".

llvm-svn: 68128
2009-03-31 18:38:02 +00:00
Steve Naroff 1bf3b718cd Add -Wdeprecated-declarations to driver and add a test case.
llvm-svn: 68117
2009-03-31 17:28:26 +00:00
Steve Naroff 66afeb5968 Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change.
Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen).

llvm-svn: 68114
2009-03-31 16:53:37 +00:00
Douglas Gregor f1b876d5de Implement -Wmissing-prototypes. Fixes PR3911.
llvm-svn: 68110
2009-03-31 16:35:03 +00:00
Chris Lattner 8b14b98bab Fix a problem in ASTContext::addRecordToClass handling forward declarations.
In a case like:

@class foo;
foo *P;

addRecordToClass was making an empty shadow struct for the foo interface and
completing it.  Later when an:

@interface foo
...
@endif

foo *Q;

was seen, ASTContext::addRecordToClass would think that foo was already laid
out and not lay out the definition.  This fixes it to create a forward declared
struct the first time around, then complete it when the definition is seen.

Note that this causes two tests to regress, because something is trying to get
the size of the forward declared structs returned by this.  Previously, this
would end up getting a size of zero but now it properly dies.  I'm not sure
what the right solution is for this, so I xfailed the tests.

Fariborz, please take a look at this.  The testcase in rdar://6676794 now gets
farther, but dies later because the objc ivar is not assigned a field number.

As an aside, I really don't like the fact that the objc front-end is creating
shadow C structs for ObjC types.  This seems like an implementation detail of
the code generator that could be fixed by better factoring of the extant code.

llvm-svn: 68106
2009-03-31 09:24:30 +00:00
Chris Lattner 6d35cc945f disable copying of Type objects.
llvm-svn: 68103
2009-03-31 08:58:42 +00:00
Chris Lattner 5b36ddb1ad fill in temporary smallvectors instead of vectors for performance.
Fix BuildAggrIvarLayout to not access vectors out of range.

llvm-svn: 68101
2009-03-31 08:48:01 +00:00
Chris Lattner f71b69f7f3 add a const version of the lookupFieldDeclForIvar method.
llvm-svn: 68094
2009-03-31 08:31:13 +00:00
Chris Lattner 5d68896c7b Codegen sometimes crashes on comparisons that aren't legal, just
disable this feature for now, to err on the side of rejecting instead
of sometimes crashing.  rdar://6326239

llvm-svn: 68088
2009-03-31 07:46:52 +00:00
Anders Carlsson 10b9f81eaf Document NamespaceAliasDecl.
llvm-svn: 68085
2009-03-31 04:51:13 +00:00
Douglas Gregor b67535d1b6 Parsing and AST representation for dependent template names that occur
within nested-name-specifiers, e.g., for the "apply" in

  typename MetaFun::template apply<T1, T2>::type

At present, we can't instantiate these nested-name-specifiers, so our
testing is sketchy.

llvm-svn: 68081
2009-03-31 00:43:58 +00:00
Fariborz Jahanian b35b4a9b42 fe support for objc2's nonfragile-abi synthesized ivars.
llvm-svn: 68077
2009-03-31 00:06:29 +00:00
Steve Naroff 7b753d21b5 Implement UCN support for C string literals (C99 6.4.3) and add some very basic tests. Chris Goller has graciously offered to write some test to help validate UCN support.
From a front-end perspective, I believe this code should work for ObjC @-strings. At the moment, I believe we need to tweak the code generation for @-strings (which doesn't appear to handle them). Will be investigating.

llvm-svn: 68076
2009-03-30 23:46:03 +00:00
Douglas Gregor dc572a3266 Improve the representation of template names in the AST. This
representation handles the various ways in which one can name a
template, including unqualified references ("vector"), qualified
references ("std::vector"), and dependent template names
("MetaFun::template apply").

One immediate effect of this change is that the representation of
nested-name-specifiers in type names for class template
specializations (e.g., std::vector<int>) is more accurate. Rather than
representing std::vector<int> as

  std::(vector<int>)

we represent it as

  (std::vector)<int>

which more closely follows the C++ grammar. 

Additionally, templates are no longer represented as declarations
(DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
OpaquePtr type (TemplateTy) that holds the representation of a
TemplateName. This will simplify the handling of dependent
template-names, once we get there.

llvm-svn: 68074
2009-03-30 22:58:21 +00:00
Ted Kremenek 7857bd2743 Re-apply 68028. The code had drifted enough that the tests would fail without
it.  Will discuss offline whether symbolic regions should by typed or typeless.

llvm-svn: 68070
2009-03-30 22:20:54 +00:00
Ted Kremenek 5715393da2 Revert 68028.
llvm-svn: 68068
2009-03-30 21:56:17 +00:00
Fariborz Jahanian 6683b8a272 Added new info to property impl. AST node to support
objc2's ivar synthesis.

llvm-svn: 68064
2009-03-30 21:33:50 +00:00
Ted Kremenek 3cd88e5d99 Remove dead code.
llvm-svn: 68063
2009-03-30 21:27:41 +00:00
Eli Friedman 1a4029c5df Implement -Wno-pointer-sign.
llvm-svn: 68062
2009-03-30 21:19:48 +00:00
Daniel Dunbar e24297c6b5 Driver: Sketch FreeBSD tool chain.
- Patch by Ed Schouten!

llvm-svn: 68061
2009-03-30 21:06:03 +00:00
Douglas Gregor b9a1d3fd44 Remove a trivial FIXME
llvm-svn: 68045
2009-03-30 18:22:51 +00:00
Ted Kremenek 4967c8979e Add version of GRExprEngine::AddCheck that registered a GRSimpleAPICheck that
will be called for every expression in a basic block.

llvm-svn: 68041
2009-03-30 17:53:05 +00:00
Zhongxing Xu 5415b207e3 Make SymbolicRegion untyped.
Layer the type information with a TypedViewRegion on top of the SymbolicRegion.

llvm-svn: 68028
2009-03-30 06:48:56 +00:00
Daniel Dunbar d67a32252c Driver: Support -M and -MM.
- Not particularly elegant, but my hand is forced by gcc.

Also, tweak -ccc-print-bindings output.

llvm-svn: 68027
2009-03-30 06:36:42 +00:00
Zhongxing Xu a865b79f87 Implement a FIXME.
llvm-svn: 68024
2009-03-30 05:55:46 +00:00
Daniel Dunbar 53b406f40a Driver: Track which original arguments an arg is derived from, so that
we can properly claim arguments, even if they have been translated by
the tool chain.

llvm-svn: 68020
2009-03-29 22:29:05 +00:00
Daniel Dunbar e2ad1c2159 Fix typo in diagnostic.
llvm-svn: 68017
2009-03-29 22:23:49 +00:00
Chris Lattner 32dc41c445 hoist some code for handling objc foreach construct out of Declaration processing
into ParseForStatement.  Merge two tests into one.

llvm-svn: 68010
2009-03-29 17:27:48 +00:00
Chris Lattner efb0f111f1 hoist checks for ; and in out of ParseInitDeclaratorListAfterFirstDeclarator
into ParseSimpleDeclaration, and improve a diagnostic.

llvm-svn: 68009
2009-03-29 17:18:04 +00:00
Chris Lattner 5bbb3c8ad9 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.

llvm-svn: 68002
2009-03-29 16:50:03 +00:00
Chris Lattner 6c84a5a394 DeclRefExpr refers to one decl, not all the declarators in a declaration.
Ted, please check this, this change causes no regression tests to fail.

llvm-svn: 68001
2009-03-29 16:35:09 +00:00
Chris Lattner 41b1601bdd Implement PointerLikeTypeTraits for DeclGroupRef.
Make OpaquePtr work with things that are pointer-like but not
necessarily pointers.

llvm-svn: 67998
2009-03-29 14:23:52 +00:00
Chris Lattner 87576f3639 remove unused #include
llvm-svn: 67994
2009-03-29 07:05:59 +00:00
Chris Lattner 63595ddcb5 switch TemplateOrInstantiation to be a PointerUnion, which
simplifies some code.

llvm-svn: 67993
2009-03-29 07:03:59 +00:00
Chris Lattner b81eb052f2 switch DeclBase::DeclCtx to the new happy and type-safe
llvm::PointerUnion class.

llvm-svn: 67988
2009-03-29 06:06:59 +00:00
Chris Lattner 57ce399326 Make the ActionResult optimization work for non-void*'s and switch DeclPtrTy to use it.
llvm-svn: 67983
2009-03-29 05:08:48 +00:00
Chris Lattner cd8bb18624 genericize the ActionResult optimization for holding the "ininvalid" bit
in the low bit position a little bit (haha).

llvm-svn: 67982
2009-03-29 05:04:26 +00:00
Chris Lattner 85e2e141db various cleanups
llvm-svn: 67981
2009-03-29 05:01:10 +00:00
Chris Lattner 20d79aa1c2 adjust to llvm mainline changes.
llvm-svn: 67980
2009-03-29 04:32:54 +00:00
Chris Lattner 59f1a41f2e add fixme
llvm-svn: 67977
2009-03-29 01:03:29 +00:00
Chris Lattner ed6b4b0598 add getNumLowBitsAvailable for OpaquePtr and QualType.
llvm-svn: 67975
2009-03-29 00:41:20 +00:00
Chris Lattner 22d059dbde follow llvm mainline, where PointerLikeTypeInfo got renamed
to PointerLikeTypeTraits.

llvm-svn: 67974
2009-03-29 00:39:47 +00:00
Chris Lattner 5ab14f5175 implement the PointerLikeTypeInfo trait for QualType, allowing
it to be stuck into a SmallPtrSet.

llvm-svn: 67967
2009-03-29 00:03:08 +00:00
Anders Carlsson c8820e5f9f Handle the case where the namespace decl is an alias.
llvm-svn: 67965
2009-03-28 23:50:18 +00:00
Anders Carlsson ff25fdf2fb Create AST nodes for namespace aliases.
llvm-svn: 67962
2009-03-28 22:58:02 +00:00
Anders Carlsson 47952aec09 Parse the location of the 'namespace' token to ActOnNamespaceAliasDef. No functionality change.
llvm-svn: 67961
2009-03-28 22:53:22 +00:00
Chris Lattner 83f095cc7e Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
pointer.  Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.

Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.

We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.

The one outstanding known problem with this patch is that we lose the 
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
this with a subsequent patch.

llvm-svn: 67952
2009-03-28 19:18:32 +00:00