Commit Graph

318 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis cbad725bf4 Change 'Wchar' to 'WChar' casing, for consistency.
No functionality change.

llvm-svn: 54588
2008-08-09 17:20:01 +00:00
Argyrios Kyrtzidis 40e9e4828f Implement support for the 'wchar_t' C++ type.
llvm-svn: 54585
2008-08-09 16:51:54 +00:00
Steve Naroff 239255d2a6 Fix Sema::MergeVarDecl() to better handle type compatibility. The previous code was trying to handle arrays specially (which didn't work for pointers to array). Removed local helper function areEquivalentArrayTypes(), replacing it's use with the more general ASTContext::typesAreCompatible() predicate.
Even though the test case this fixes is in "tentative-decls.c", this bug didn't have anything to do with our handling of tentative definitions (which is what I first expected). In any event, this is a tricky area of the spec.

llvm-svn: 54583
2008-08-09 16:04:40 +00:00
Argyrios Kyrtzidis 2f67f37daf When in C++, invoke ASTConsumer::HandleTagDeclDefinition in Sema::ActOnFinishCXXClassDef,
at which point the C++ struct/class/union is fully parsed.

llvm-svn: 54569
2008-08-09 00:58:37 +00:00
Argyrios Kyrtzidis 5c45c9b063 Passing right brace location to ActOnFinishCXXClassDef is redundant, since it gets passed to ActOnFinishCXXMemberSpecification too.
llvm-svn: 54567
2008-08-09 00:39:29 +00:00
Steve Naroff 5bb8f2264b Fix issues with C "tentative" definitions.
- Move checking from MergeVarDecl->FinializeDeclaratorGroup. Since MergeVarDecl is called before the initializer is attacted, it can't be done there (this removes a long standing FIXME).
- Add Sema::isTentativeDefinition() and Sema::CheckForFileScopedRedefinitions().
- Remove FIXME's and touch-up test case.

Still some more work to do (forthcoming)...

llvm-svn: 54533
2008-08-08 17:50:35 +00:00
Ted Kremenek dcb5e38927 ParseAST now never releases the passed ASTConsumer. This is the responsibility of the client.
The motivation is that clients may either:

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

llvm-svn: 54502
2008-08-08 02:46:37 +00:00
Ted Kremenek 4a35180f6d Use DeclStmt::decl_iterator instead of walking the getNextDeclarator() chain.
llvm-svn: 54501
2008-08-08 02:45:18 +00:00
Ted Kremenek 7db4f60b26 ParseAST now conditionally deletes the passed ASTConsumer.
ModuleBuilder now performs llvmgen in HandleTranslationUnit.

This patch follows from the discussion on the following thread on cfe-commits:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080804/006849.html

llvm-svn: 54486
2008-08-07 19:47:41 +00:00
Steve Naroff f960c0bb9e Sema::ActOnEnumBody(): handle nested enum redefinitions.
Fixes <rdar://problem/6093889> Nested enum redefinition crashes sema.

llvm-svn: 54463
2008-08-07 14:08:16 +00:00
Ted Kremenek 955516e6c7 attribute "unused" also applies to functions.
llvm-svn: 54440
2008-08-07 01:02:05 +00:00
Ted Kremenek c3b4c52a4d Fix <rdar://problem/6125909>.
Unify logic in return-of-stack-check (Sema) for casts and implicit casts.

llvm-svn: 54439
2008-08-07 00:49:01 +00:00
Daniel Dunbar ffc29be83f Implement GNU asm-label extension support in CodeGen. This fixes
scimark2 on Darwin.

 - Added Sema support for asm-label on variables, which I forgot before.

 - Update CodeGen to use GlobalDeclMap to determine if static Decls
   require emission (instead of LLVM module name lookup). Important
   since the Decl name and the LLVM module name can differ.

 - <rdar://problem/6116729>

llvm-svn: 54388
2008-08-06 00:03:29 +00:00
Daniel Dunbar 1ff1d1fd51 Move AsmLabel into Declarator instead of just a parameter to
ActOnDeclarator.

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

llvm-svn: 54339
2008-08-05 01:35:17 +00:00
Daniel Dunbar b692ef405b Fix several issues in checking of address-of expressions.
- clang was erroneously accepting address-of applied to lvalue
   expressions involving pointer arithmetic.
 - clang was erroneously rejecting address-of applied to deref
   expressions of pointer-typed variables.
 - Improved existing test case.
 - Fixes: <rdar://problem/6113867>, <rdar://problem/6080158>

llvm-svn: 54326
2008-08-04 20:02:37 +00:00
Daniel Dunbar 88402ce8d0 Add CodeGen support for indirect goto.
- Follows emission scheme used by llvm-gcc, i.e. invent an id for
   each label whose address is taken and replace each indirect goto by
   a switch to each possible target.
 - Currently we emit a switch for each indirect goto instead of
   merging them as llvm-gcc does.

llvm-svn: 54318
2008-08-04 16:51:22 +00:00
Chris Lattner 7adf076088 Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.

llvm-svn: 54317
2008-08-04 07:31:14 +00:00
Argyrios Kyrtzidis 25d05e88a5 Wherever a type is used/returned from the Action module, use TypeTy instead of DeclTy or void.
No functionality change.

llvm-svn: 54265
2008-08-01 10:35:27 +00:00
Argyrios Kyrtzidis 85324837ce Make the default constructor of IdentifierResolver::iterator public.
llvm-svn: 54264
2008-08-01 10:20:48 +00:00
Daniel Dunbar 032db47f0f Support __attribute__(({con,de}structor)) in Parse & Sema
- Including possible priority argument
 - In other news, the attribute parsing code really needs a cleanup

llvm-svn: 54257
2008-07-31 22:40:48 +00:00
Chris Lattner 872eb55f5e make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.

llvm-svn: 54116
2008-07-27 00:48:22 +00:00
Chris Lattner 35ffe331b9 remove two uses of getCanonicalType I missed.
llvm-svn: 54114
2008-07-27 00:05:05 +00:00
Chris Lattner 574dee6cac change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)

llvm-svn: 54105
2008-07-26 22:17:49 +00:00
Chris Lattner 6731544be7 convert more code to use ASTContext to get canonical types instead
of doing it directly.  This is required for PR2189.

llvm-svn: 54102
2008-07-26 21:30:36 +00:00
Chris Lattner ac87ef5dcc remove a helper method.
llvm-svn: 54101
2008-07-26 20:50:02 +00:00
Chris Lattner 944d306371 fix some problems handling stmtexprs with labels (PR2374), and
improve 'expression unused' diagnostics for stmtexprs.

llvm-svn: 54098
2008-07-26 19:51:01 +00:00
Chris Lattner df59f5aa3c Pull protocol resolution of out ActOnStartClassInterface, this is also the
last client of the old ParseObjCProtocolReferences, so it also removes it.

llvm-svn: 54094
2008-07-26 04:13:19 +00:00
Chris Lattner b1f3c948ee refactor protocol resolution out of ActOnStartCategoryInterface
llvm-svn: 54093
2008-07-26 04:07:02 +00:00
Chris Lattner 3bbae00f50 pull protocol resolution out into ActOnStartProtocolInterface.
This temporarily duplicates ParseObjCProtocolReferences, but it
will be removed in the future.

llvm-svn: 54092
2008-07-26 04:03:38 +00:00
Chris Lattner 9c1842b612 simplify some code.
llvm-svn: 54091
2008-07-26 03:47:43 +00:00
Chris Lattner 908d39e45e remove duplicate error message.
llvm-svn: 54090
2008-07-26 03:40:25 +00:00
Chris Lattner bc76297674 make DeclSpec manage its own protocol qualifier list memory instead of having
clients allocate the memory and it delete it.

llvm-svn: 54087
2008-07-26 01:53:50 +00:00
Chris Lattner a075e63bbc fix several problems with the protocol qualified id handling where id was implicit.
First, fix canonical type handling of these, since protocol qualified id's are always
canonical.  Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate.  Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's.  This fixes
rdar://5986251

llvm-svn: 54083
2008-07-26 00:46:50 +00:00
Chris Lattner 0d70761cad GCC supports the complex conjugate operator (an extension) on complex int
as well as complex float. rdar://6097730

llvm-svn: 54080
2008-07-25 23:52:49 +00:00
Chris Lattner 903eb518e6 Fix rdar://6095136, various crashes with incomplete enum types.
llvm-svn: 54074
2008-07-25 23:18:17 +00:00
Chris Lattner 2ce500ffbe move a method.
llvm-svn: 54069
2008-07-25 22:25:12 +00:00
Chris Lattner bea82ff6ed Fix a couple bugs in aggregate cast processing: 1) fix precedecence
problem with &&/||.  2) use canonical types for comparison instead 
of raw types. 3) emit an ext-warn for a gnu extension.

Also simplify the code to make it less nested.

llvm-svn: 54068
2008-07-25 22:06:10 +00:00
Ted Kremenek 870f750434 Format string errors should underling the format string, not the function name.
llvm-svn: 54067
2008-07-25 22:03:03 +00:00
Chris Lattner 3f375d055e make sizeof/alignof diagnostics highlight their operand with a sourcerange.
llvm-svn: 54066
2008-07-25 21:45:37 +00:00
Chris Lattner 61f60a05b2 c89 does not perform array -> pointer promotion unless the array is an lvalue. This
is different than C99.  This fixes the rest of rdar://6095180.

llvm-svn: 54064
2008-07-25 21:33:13 +00:00
Chris Lattner 513165ecf3 move some code, no other change.
llvm-svn: 54063
2008-07-25 21:10:04 +00:00
Chris Lattner f6e1e309c7 In c99 mode, comma does do function/array promotion even though
it does not do unary promotions (like short->int).

llvm-svn: 54058
2008-07-25 20:54:07 +00:00
Chris Lattner e174acc910 Comma does not perform unary promotions, rdar://6095180
llvm-svn: 54045
2008-07-25 20:02:29 +00:00
Steve Naroff e2177fbfdc Cleaunup Sema::ActOnClassMessage(). This commit:
(a) removes a bogus warning.
(b) removes an undesirable usage of the ObjCMessageExpr constructor that takes an IdentifierInfo * (which I will abolish).

llvm-svn: 54042
2008-07-25 19:39:00 +00:00
Chris Lattner f9c49e5d27 Reject typedef redefinitions when the underlying types are not identical,
even if in a system header etc.  rdar://6079937

llvm-svn: 54038
2008-07-25 18:44:27 +00:00
Steve Naroff 542cd5d3f9 Move fix in r54013 from the parser to sema.
llvm-svn: 54032
2008-07-25 17:57:26 +00:00
Ted Kremenek 39c59a8887 Implemented Sema support for attribute "unused".
llvm-svn: 54008
2008-07-25 04:39:19 +00:00
Ted Kremenek 77c51b2aa3 Move isObjCObjectPointerType() from Sema to ASTContext.
llvm-svn: 53998
2008-07-24 23:58:27 +00:00
Steve Naroff 6c79f97037 Fix Sema::ActOnClassMessage() to pass through the identifier for "super".
This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super').

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

llvm-svn: 53994
2008-07-24 19:44:33 +00:00