Argyrios Kyrtzidis
8ae3684aa9
In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
...
Fixes this bug:
int (x)(0); // error, expected function declarator where the '(0)' initializer is
llvm-svn: 57241
2008-10-07 10:21:57 +00:00
Argyrios Kyrtzidis
9a1191c047
Implement support for C++ direct initializers in declarations, e.g. "int x(1);".
...
This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.
e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.
A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.
llvm-svn: 57178
2008-10-06 17:10:33 +00:00
Argyrios Kyrtzidis
e8addf5e04
Allow variadic arguments without named ones for C++, e.g. "void(...);"
...
llvm-svn: 57143
2008-10-06 00:07:55 +00:00
Argyrios Kyrtzidis
4217c7ec81
A tiny optimization; use isCXXFunctionDeclarator only when it's appropriate.
...
llvm-svn: 57141
2008-10-05 23:15:41 +00:00
Argyrios Kyrtzidis
279d9814e5
Add some text from the C++ standard and additional ambiguity resolution tests.
...
No funcitonality change.
llvm-svn: 57136
2008-10-05 21:10:08 +00:00
Argyrios Kyrtzidis
2b1ef227f5
Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:
...
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.
llvm-svn: 57131
2008-10-05 19:56:22 +00:00
Argyrios Kyrtzidis
df788f4eea
Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
...
This was the motivation of the following changes:
-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).
llvm-svn: 57125
2008-10-05 18:52:21 +00:00
Anders Carlsson
c181b01681
Add parsing of the sentinel attribute. Still need to create the attribute.
...
llvm-svn: 57121
2008-10-05 18:05:59 +00:00
Argyrios Kyrtzidis
bc28fefcde
Disambiguate between a declaration or an expression, in the 'for-init-statement' part of a 'for' statement.
...
llvm-svn: 57112
2008-10-05 15:50:46 +00:00
Argyrios Kyrtzidis
2534620b4e
Fix Parser::isCXXConditionDeclaration to properly resolve declarations.
...
llvm-svn: 57111
2008-10-05 15:19:49 +00:00
Argyrios Kyrtzidis
71f3e19df0
Disambiguate between a declaration or expression for the 'condition' part of a if/switch/while/for statement.
...
llvm-svn: 57109
2008-10-05 15:03:47 +00:00
Argyrios Kyrtzidis
7b87f27438
Consider GNU attributes when doing ambiguity resolution.
...
llvm-svn: 57108
2008-10-05 14:27:18 +00:00
Argyrios Kyrtzidis
2c7137d8d1
Resolve ambiguous C++ statements (C++ 6.8p1).
...
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.
llvm-svn: 57084
2008-10-05 00:06:24 +00:00
Daniel Dunbar
921b968841
Add Parser support for #pragma pack
...
- Uses Action::ActOnPragmaPack
- Test case is XFAIL pending verifier fixes.
llvm-svn: 57066
2008-10-04 19:21:03 +00:00
Daniel Dunbar
e4ac7a4059
Remove a FIXME.
...
llvm-svn: 57015
2008-10-03 16:42:10 +00:00
Daniel Dunbar
15619c7e4b
Pass postfix attributes to ActOnFields.
...
llvm-svn: 56992
2008-10-03 02:03:53 +00:00
Ted Kremenek
68d2190226
Enter a new scope for a @try block.
...
llvm-svn: 56668
2008-09-26 17:32:47 +00:00
Daniel Dunbar
26e2ab4a37
Parser support for prefix __attribute__ on @protocol.
...
llvm-svn: 56642
2008-09-26 04:48:09 +00:00
Ted Kremenek
a34ea3b9cf
Have @finally introduce a new scope.
...
Fixes: <rdar://problem/6248119> @finally doesn't introduce a new scope
llvm-svn: 56629
2008-09-26 00:31:16 +00:00
Steve Naroff
cd5e782bce
Fix http://llvm.org/bugs/show_bug.cgi?id=2816 .
...
llvm-svn: 56433
2008-09-22 10:28:57 +00:00
Chris Lattner
a7b034463e
Fix rdar://6222856: the receiver of a message expr is an
...
arbitrary expr, not just a assign expr. The grammar comment
was right, the code was just wrong.
llvm-svn: 56353
2008-09-19 17:44:00 +00:00
Steve Naroff
3405a73ab8
Finish pushing blocks attribute through the clang attribute machinery.
...
Also added a couple simple tests from the "gcc.apple" test suite.
llvm-svn: 56309
2008-09-18 16:44:58 +00:00
Steve Naroff
7a147c6a3c
Remove support for BlockExprExpr. For example...
...
^(expression) or ^(int arg1, float arg2)(expression)
...is no longer supported.
All block literals now require a compound statement.
llvm-svn: 56257
2008-09-16 23:11:46 +00:00
Argyrios Kyrtzidis
47f9865182
Add comments about C++ clause 3.3.2p4 that mentions that the condition declaration should be local to an if/switch/while/for statement.
...
llvm-svn: 56134
2008-09-11 23:08:39 +00:00
Argyrios Kyrtzidis
fea38016a9
Fix do-while scoping in C++.
...
llvm-svn: 56095
2008-09-11 04:46:46 +00:00
Argyrios Kyrtzidis
504bb844ba
Revert r56078, getLang().C99 being true in C++ is a bug that will be fixed.
...
llvm-svn: 56090
2008-09-11 03:06:46 +00:00
Argyrios Kyrtzidis
f01fa82423
Fold Parser::ParseTag into Parser::ParseEnumSpecifier, as suggested in this post:
...
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002721.html
llvm-svn: 56081
2008-09-11 00:21:41 +00:00
Argyrios Kyrtzidis
48dea3b9f5
-getLang().C99 is true in C++ too, remove the use of the C99orCXX variable.
...
-Scoping in C99 works good for C++ too, remove the C++-specific comments.
If someone thinks that the C++-specific comments are necessary for clarification, let me know and I'll put them back on.
llvm-svn: 56078
2008-09-10 23:46:08 +00:00
Argyrios Kyrtzidis
eece3fe4fd
Add some C++-specific comments in the parsing methods of if/switch/while/for.
...
llvm-svn: 56060
2008-09-10 17:38:35 +00:00
Argyrios Kyrtzidis
2b4072fe55
Implement parser support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
...
Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression.
llvm-svn: 56007
2008-09-09 20:38:47 +00:00
Argyrios Kyrtzidis
dee8291a14
Support C++'s declaration-statement.
...
llvm-svn: 55888
2008-09-07 18:58:01 +00:00
Argyrios Kyrtzidis
2545aeb710
Support "typeof unary-expression" (GNU C++ extension).
...
llvm-svn: 55833
2008-09-05 11:26:19 +00:00
Steve Naroff
0ac012835f
Add parser/action support for block literal expressions.
...
Parser support for blocks is almost complete...just need to add support for the __block() storage class qualifier.
llvm-svn: 55495
2008-08-28 19:20:44 +00:00
Steve Naroff
94e3ab20b7
Fix Parser::ParseDeclaratorInternal(): add langopts test when recognizing blocks.
...
llvm-svn: 55468
2008-08-28 10:07:06 +00:00
Steve Naroff
ec33ed9ced
First wave of changes to support "blocks" (an extension to C).
...
This commit adds the declaration syntax (and associated type).
llvm-svn: 55417
2008-08-27 16:04:49 +00:00
Daniel Dunbar
ad3cdc2ba7
Synthesize property setter method as we do for getter.
...
- Also, fix Parser to construct proper SetterName selector (should be
lifted out of parser though).
llvm-svn: 55352
2008-08-26 02:32:45 +00:00
Argyrios Kyrtzidis
bf667e23d1
Pass SourceRanges by reference to the various Diag methods.
...
llvm-svn: 55284
2008-08-24 13:14:02 +00:00
Argyrios Kyrtzidis
26da1f46e4
Add a Parser::Diag overload that can receive a custom string along with a SourceRange.
...
llvm-svn: 55283
2008-08-24 12:51:04 +00:00
Anders Carlsson
6305c5f437
Add support for parsing the objc_gc attribute. Tests will come shortly.
...
llvm-svn: 55269
2008-08-23 23:22:21 +00:00
Anders Carlsson
f93f56a28e
Reserved C++ words are valid selectors in Objective-C++
...
llvm-svn: 55253
2008-08-23 21:00:01 +00:00
Chris Lattner
f440440616
make sure that ParseAST invokes the action for end of translation unit.
...
llvm-svn: 55222
2008-08-23 03:19:52 +00:00
Chris Lattner
9e8c057ab7
add action to know about end of translation unit.
...
llvm-svn: 55218
2008-08-23 02:06:50 +00:00
Chris Lattner
ce90ef51b9
we already have a handle on the 'in' keyword, don't bother getting two.
...
llvm-svn: 55217
2008-08-23 02:02:23 +00:00
Chris Lattner
2cc35ae286
minor cleanup, remove finalize method.
...
llvm-svn: 55216
2008-08-23 02:00:52 +00:00
Chris Lattner
2ebb178f8b
Fix a FIXME by not creating an invalid AST on erroneous input. Also
...
make diagnostic output in some other malformed cases significantly
more useful. This fixes PR2708
llvm-svn: 55215
2008-08-23 01:48:03 +00:00
Argyrios Kyrtzidis
857fcc2f8e
Add support for C++'s "type-specifier ( expression-list )" expression:
...
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
-If the type is a class, it will treat it as a class constructor. [TODO]
-If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
-If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.
llvm-svn: 55177
2008-08-22 15:38:55 +00:00
Eli Friedman
002ad1274b
Fix a minor crash-on-invalid.
...
llvm-svn: 55082
2008-08-20 22:07:34 +00:00
Argyrios Kyrtzidis
22fc2665e6
"Remove the 'else' since the code is fallthrough after it." - suggestion by Chris.
...
llvm-svn: 54952
2008-08-18 22:49:40 +00:00
Argyrios Kyrtzidis
69af9eebd7
Put (argument)-expression-list parsing in a separate function so that it can be re-used.
...
llvm-svn: 54851
2008-08-16 20:03:01 +00:00
Argyrios Kyrtzidis
16d63a727e
C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces.
...
llvm-svn: 54850
2008-08-16 19:45:32 +00:00