Commit Graph

490 Commits

Author SHA1 Message Date
Chris Lattner 3e4683262e implement simple support for arbitrary token lookahead. Change the
objc @try parser to use it, fixing a FIXME.  Update the 
objc-try-catch-1.m file to pass now that we get more reasonable 
errors.

llvm-svn: 48129
2008-03-10 06:06:04 +00:00
Nate Begeman 0a6192cfb8 Add fastcall/stdcall attribute support
Generate CallingConv::Fast when fastcall attribute is present

llvm-svn: 48017
2008-03-07 20:04:22 +00:00
Chris Lattner 8496639787 Add a bunch of attributes, patch by Nuno Lopes.
llvm-svn: 47837
2008-03-03 03:28:21 +00:00
Steve Naroff 83777fef1a Fix http://llvm.org/bugs/show_bug.cgi?id=2106.
llvm-svn: 47768
2008-02-29 21:48:07 +00:00
Chris Lattner 8a8558bcd4 Add support for attribute(deprecated), patch by Nuno Lopes!
llvm-svn: 47753
2008-02-29 16:48:43 +00:00
Ted Kremenek f7146ca3bc Added support for attribute "noreturn."
llvm-svn: 47689
2008-02-27 20:43:06 +00:00
Chris Lattner b7e656b177 add parsing, ast building and pretty printing support for C++ throw expressions.
Patch by Mike Stump!

llvm-svn: 47582
2008-02-26 00:51:44 +00:00
Chris Lattner eb85ab44f2 convert tabs to spaces, patch by Mike Stump!
llvm-svn: 47560
2008-02-25 21:04:36 +00:00
Nate Begeman d45d38d2b7 Handle __attribute__((annotate("string")))
llvm-svn: 47451
2008-02-21 19:30:49 +00:00
Chris Lattner 788404f312 Collect and build and process type attributes on pointers. For
example, we can now correctly build the type for things like:
    _AS1 float * _AS2 *B;

llvm-svn: 47420
2008-02-21 01:32:26 +00:00
Chris Lattner f18c743222 add a method to AttributeList that converts an identifier to an enum.
llvm-svn: 47412
2008-02-20 23:14:47 +00:00
Chris Lattner 99a59b6ba0 ParseCompoundStatementBody expects to only be called with { as the current
token.  Diagnose when the { is missing in objc @try blocks instead of aborting.

llvm-svn: 47130
2008-02-14 19:27:54 +00:00
Steve Naroff 2d868f2bcd Remove DeclSpec::Invalid, a recently added bool that allowed the parser to detect if the decl spec was invalid.
For now, we will stick with the original strategy - clients of Parse::ParseDeclarationSpecifiers() should never have to know this.

llvm-svn: 47104
2008-02-14 03:30:24 +00:00
Steve Naroff f631997cb5 A much better fix for http://llvm.org/bugs/show_bug.cgi?id=1987.
llvm-svn: 47103
2008-02-14 02:58:32 +00:00
Steve Naroff ab468cb14b Allow the parser to detect invalid DeclSpec's. This fixes http://llvm.org/bugs/show_bug.cgi?id=1987.
This commit only "guards" the call to ParseDeclarationSpecifiers() in ParseDeclarationOrFunctionDefinition(). 

We could consider guarding all calls, however this is a bit radical (since it effectively stops parsing the declaration once we have a bad declspec). Will discuss with Chris tomorrow.

llvm-svn: 46984
2008-02-12 04:08:59 +00:00
Steve Naroff 69e8f9efab Several cleanups surrounding Parser::ParseAsmStatement() and Parser::FuzzyParseMicrosoftAsmStatement().
llvm-svn: 46977
2008-02-11 23:15:56 +00:00
Steve Naroff bff738543d Move policy on unnamed fields (a Microsoft extension) from Parser::ParseStructDeclaration() to the driver.
llvm-svn: 46974
2008-02-11 22:40:08 +00:00
Steve Naroff 5915777fca Move Microsoft __declspec hack from the parser to the preprocessor. Since we have no plans to actually implement this construct, it is cleaner to limit the change to the preprocessor.
llvm-svn: 46973
2008-02-11 22:29:58 +00:00
Chris Lattner 7b8134f5c6 Fix PR1999, by emitting a hard error only if an argument declarator is completely
missing.  Otherwise, it is an implicit int case, which is valid in c90 and invalid 
elsewhere, but accepted as an extension.

llvm-svn: 46938
2008-02-10 23:08:00 +00:00
Anders Carlsson 2e64d1a50f Behave correctly if a constraint expression is invalid.
llvm-svn: 46910
2008-02-09 19:57:29 +00:00
Steve Naroff 8c099c3f03 Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
llvm-svn: 46885
2008-02-08 18:01:27 +00:00
Steve Naroff db5f7d7699 Support fuzzy parsing MS line-oriented __asm's that originate from a macro (a case where we can't obtain source line info). As the test case indicates, we don't currently support line-oriented asm statements that mix file/macro body tokens.
llvm-svn: 46878
2008-02-08 03:36:19 +00:00
Anders Carlsson 5c6c05956e Put back the top-level asm code; all tests pass now.
llvm-svn: 46868
2008-02-08 00:33:21 +00:00
Anders Carlsson 0fae4f56df Back out 46855 for now, it causes test failures on Darwin.
llvm-svn: 46867
2008-02-08 00:23:11 +00:00
Steve Naroff 4e79d340bd - Add support for fuzzy parsing line-oriented __asm's (yuck).
- Change handling of __w64 to a built-in macro.

llvm-svn: 46864
2008-02-07 23:24:32 +00:00
Anders Carlsson bcc3a4bf64 Handle top-level asm declarations.
llvm-svn: 46855
2008-02-07 17:19:11 +00:00
Steve Naroff 6936a08704 Minor cleanup from yesterday's -fms-extension commit. Move __int* MS keywords to predefined macros. This removes some of the MS-madness from Parser::ParseDeclarationSpecifiers().
llvm-svn: 46852
2008-02-07 15:26:07 +00:00
Steve Naroff b2c80c7c7b Implement -fms-extensions. This allows us to fuzzy parse non-standard MS constructs used in "windows.h".
llvm-svn: 46838
2008-02-07 03:50:06 +00:00
Steve Naroff 2352150043 Add a FIXME to clarify previous commit/experiment.
llvm-svn: 46782
2008-02-05 23:59:27 +00:00
Anders Carlsson 19fe116fc0 Handle simple asm statements correctly.
llvm-svn: 46777
2008-02-05 23:03:50 +00:00
Steve Naroff e6016798bf Fix Parser::ParseObjCTryStmt() to allow for trailing @-keyword statements/expressions.
This bug fix is the result of not having 2-token lookahead to recognize specific @-keywords.

llvm-svn: 46768
2008-02-05 21:27:35 +00:00
Chris Lattner c43926fe67 Implement support for __extension__ which silences extwarnings in its
scope.  This is part of the fix for PR1966

llvm-svn: 46669
2008-02-02 20:20:10 +00:00
Steve Naroff e97c4ab30c Fix http://llvm.org/bugs/show_bug.cgi?id=1967.
llvm-svn: 46616
2008-01-31 18:29:10 +00:00
Chris Lattner 7f024fe0c6 Fix PR1965: missing diagnostics for parameters that are missing
type specifiers.  This required updating some (buggy) tests, and the
testcase was previously accidentally committed.

llvm-svn: 46603
2008-01-31 06:10:07 +00:00
Nate Begeman 4cd6689d1f Remainder of the __builtin_overload feedback
llvm-svn: 46601
2008-01-31 05:38:29 +00:00
Chris Lattner 8f39876ac3 On an unexpected @foo keyword, return failure instead of a 'successful' null AST. This fixes a segfault
on things like @foo.

llvm-svn: 46574
2008-01-30 21:20:25 +00:00
Fariborz Jahanian 049fa58d0d Fixed misc. issues raised by Chris L. on @synchronized implementation.
llvm-svn: 46558
2008-01-30 17:38:29 +00:00
Fariborz Jahanian 48085b86ae AST for @synchronized.
llvm-svn: 46524
2008-01-29 19:14:59 +00:00
Fariborz Jahanian f89ca383d7 Bunch of type defs, etc. for @synchronized.
llvm-svn: 46520
2008-01-29 18:21:32 +00:00
Steve Naroff fda820970a Add more support for Apple's "private extern" extension...
llvm-svn: 46371
2008-01-25 22:14:40 +00:00
Chris Lattner 77927cc33c Add support for dispatching an objc message to a variable
in an initializer list.

llvm-svn: 46367
2008-01-25 19:43:26 +00:00
Chris Lattner 8917c5ace2 First half of a fix for the "objc message send in initializer" bug. This only
handles message sends with typenames to start with.

llvm-svn: 46366
2008-01-25 19:37:24 +00:00
Chris Lattner e10c6da41e Factor a complex predicate out to a helper method.
llvm-svn: 46365
2008-01-25 19:25:00 +00:00
Chris Lattner 8f6970663a split the second half of ParseObjCMessageExpression into a new
ParseObjCMessageExpressionBody method.

llvm-svn: 46363
2008-01-25 18:59:06 +00:00
Chris Lattner b241a1ba4c remove an implemented todo
llvm-svn: 46362
2008-01-25 18:58:06 +00:00
Nate Begeman 1e36a85f64 Implement basic overload support via a new builtin, __builtin_overload.
__builtin_overload takes 2 or more arguments:
0) a non-zero constant-expr for the number of arguments the overloaded 
   functions will take
1) the arguments to pass to the matching overloaded function
2) a list of functions to match.

The return type of __builtin_overload is inferred from the function whose args
match the types of the arguments passed to the builtin.  For example:

float a;
float sinf(float);
int   sini(int);

float b = __builtin_overload(1, a, sini, sinf);

Says that we are overloading functions that take one argument, and trying to 
pass an argument of the same type as 'a'.  sini() does not match since it takes
and argument of type int.  sinf does match, so at codegen time this will turn
into float b = sinf(a);

llvm-svn: 46132
2008-01-17 17:46:27 +00:00
Chris Lattner 65531e8fb7 Fix a fixme, by only parsing extern "C" in C++ mode.
llvm-svn: 45905
2008-01-12 07:08:43 +00:00
Chris Lattner 38376f1595 Add first pieces of support for parsing and representing
extern "C" in C++ mode.  Patch by Mike Stump!

llvm-svn: 45904
2008-01-12 07:05:38 +00:00
Fariborz Jahanian c644ee4992 Warn (as gcc does) when @end does not close anything.
llvm-svn: 45834
2008-01-10 17:58:07 +00:00
Ted Kremenek 1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00