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
Argyrios Kyrtzidis
37779ade44
Move handling of postfix-expression suffixes out of ParseCXXThis and into ParseCastExpression.
...
No functionality change, this follows the convention of how postfix-expressions are handled.
llvm-svn: 54849
2008-08-16 19:34:46 +00:00
Argyrios Kyrtzidis
e97dcc1248
Set the SourceRange ending of DeclSpec, when Parser::ParseTypeofSpecifier finishes.
...
llvm-svn: 54840
2008-08-16 10:21:33 +00:00
Daniel Dunbar
12c9ddced1
Change Parser & Sema to use interned "super" for comparions.
...
- Added as private members for each because it is not clear where to
put the common definition. Perhaps the IdentifierInfos all of these
"pseudo-keywords" should be collected into one place (this would
KnownFunctionIDs and Objective-C property IDs, for example).
Remove Token::isNamedIdentifier.
- There isn't a good reason to use strcmp when we have interned
strings, and there isn't a good reason to encourage clients to do
so.
llvm-svn: 54794
2008-08-14 22:04:54 +00:00
Daniel Dunbar
56fdb6ae69
More #include cleaning
...
- Kill unnecessary #includes in .cpp files. This is an automatic
sweep so some things removed are actually used, but happen to be
included by a previous header. I tried to get rid of the obvious
examples and this was the easiest way to trim the #includes in one
fell swoop.
- We now return to regularly scheduled development.
llvm-svn: 54632
2008-08-11 06:23:49 +00:00
Daniel Dunbar
c74b5cc2bc
More #include cleaning
...
- Drop Diagnostic.h from DeclSpec.h, move utility Diag methods into
implementation .cpp
llvm-svn: 54626
2008-08-11 03:45:03 +00:00
Chris Lattner
6307f19726
rename PreDefinedExpr -> PredefinedExpr
...
llvm-svn: 54605
2008-08-10 01:53:14 +00:00
Argyrios Kyrtzidis
40e9e4828f
Implement support for the 'wchar_t' C++ type.
...
llvm-svn: 54585
2008-08-09 16:51:54 +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
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
Chris Lattner
197a301669
Fix rdar://6124613 a crash on invalid code.
...
llvm-svn: 54340
2008-08-05 06:19:09 +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
Ted Kremenek
be9b33bf0f
Nico Weber:
...
"the attached patch fixes some typos, 80 cols violations, etc. in comments."
llvm-svn: 54328
2008-08-04 22:51:42 +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
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
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
8b2ec166b8
< only starts a declspec in objc mode.
...
llvm-svn: 54089
2008-07-26 03:38:44 +00:00
Chris Lattner
12fd035d6f
remove fixed fixme
...
llvm-svn: 54088
2008-07-26 01:56:46 +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
16fac4f2ad
Fix hte next wave of problems with protocol qualified ID:
...
1) reject stuff like "id<foo> short" and "<foo> short". 2) set
the declspec range correctly 3) only parse protocol qualifiers
when in objc mode.
llvm-svn: 54086
2008-07-26 01:18:38 +00:00
Chris Lattner
0974b2380f
improve handling of the horrible GCC objc extension that treats "<foo>"
...
like "id<foo>". This 1) fixes an infinite loop in the parser on things
like "short<foo>" 2) emits a warning about this bogus construct and 3)
changes the testcase to be substantially reduced.
llvm-svn: 54082
2008-07-26 00:20:22 +00:00
Chris Lattner
9acd2f1cd2
add a new diag helper that takes a range.
...
llvm-svn: 54081
2008-07-26 00:16:04 +00:00
Chris Lattner
e08e47ab2f
gcc requires a semicolon at the end of an interface, unlike its extension for structs.
...
rdar://6095245.
llvm-svn: 54044
2008-07-25 19:54:55 +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
Steve Naroff
ce5206b4f2
Fix Parser::ParseObjCMethodDefinition(). Only call the actions module for valid MDecl's.
...
llvm-svn: 54013
2008-07-25 14:30:25 +00:00
Chris Lattner
d7352d6801
minor cleanup to the actions interface to pass around SmallVectorImpl instead
...
of a specific smallvector size.
Fix protocol lists to pass down proper location info, so we get diagnostics
like this:
t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^
instead of this:
t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^
Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation>
llvm-svn: 53883
2008-07-21 22:17:28 +00:00
Chris Lattner
046485640d
fix typo
...
llvm-svn: 53848
2008-07-21 07:13:18 +00:00
Argyrios Kyrtzidis
16c04102ed
Add 'this' in the comments of Parser::ParseCastExpression to indicate that it is handled.
...
llvm-svn: 53665
2008-07-16 07:23:27 +00:00
Ted Kremenek
10c8d7653b
Use lowercase of attribute iboutlet to not conflict with the macro IBOutlet
...
llvm-svn: 53645
2008-07-15 22:38:34 +00:00
Ted Kremenek
8e3704d35a
Added parsing/sema support for __attribute__ ((IBOutlet)), a clang-specific attribute that the static analyzer will use to recognize what ivars are IBOutlets.
...
llvm-svn: 53644
2008-07-15 22:26:48 +00:00
Argyrios Kyrtzidis
07b8b63f9f
Use of NextToken() makes ParseIdentifierStatement unnecessary.
...
Simplify the parser by removing Parser::ParseIdentifierStatement.
llvm-svn: 53520
2008-07-12 21:04:42 +00:00
Argyrios Kyrtzidis
832e898803
Simplify the parser a bit by looking at the next token without consuming it (by Preprocessor::LookNext):
...
-Remove ParseExpressionWithLeadingIdentifier and ParseAssignmentExprWithLeadingIdentifier.
-Separate ParseLabeledStatement from ParseIdentifierStatement.
llvm-svn: 53376
2008-07-09 22:53:07 +00:00
Argyrios Kyrtzidis
ed9834272f
Add Sema support for C++ classes.
...
llvm-svn: 52956
2008-07-01 10:37:29 +00:00
Argyrios Kyrtzidis
f4ebe9ea4f
Handle unnamed bitfields when parsing C++ classes.
...
llvm-svn: 52855
2008-06-28 08:10:48 +00:00
Chris Lattner
cf31de3760
Make Declarator::getDeclSpec() return a const reference to avoid
...
cases where mutation can introduce bugs. Propagate around 'const'.
llvm-svn: 52772
2008-06-26 06:49:43 +00:00
Argyrios Kyrtzidis
a781452193
The only caller of this knows that the current token is l_brace, so this can be an assert; suggestion by Chris.
...
llvm-svn: 52696
2008-06-24 22:31:41 +00:00
Argyrios Kyrtzidis
7bbb20e338
Add parsing support for C++ classes.
...
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.
llvm-svn: 52694
2008-06-24 22:12:16 +00:00
Chris Lattner
535b830449
add parser and sema support for the funny ObjC '@defs' thing.
...
Patch by David Chisnall!
llvm-svn: 52586
2008-06-21 19:39:06 +00:00
Argyrios Kyrtzidis
e6aff3db25
K&R-style functions not allowed in C++.
...
llvm-svn: 52575
2008-06-21 10:00:56 +00:00
Mike Stump
65643c6480
One more test checkin.
...
Remove an extra space at the end of a line.
llvm-svn: 52504
2008-06-19 19:52:46 +00:00
Mike Stump
01e07653d4
Test commit to see if new account works.
...
I choose to remove extraneous whitespace at end of lines as a semantic
nop for the test.
llvm-svn: 52503
2008-06-19 19:28:49 +00:00
Nuno Lopes
b6f7953818
implement the alias attirbute (in both Sema and Codegen)
...
llvm-svn: 52092
2008-06-08 15:45:52 +00:00
Ted Kremenek
09a0d04ea0
Initial work on additional memory collection for ObjC AST objects. We now
...
have Destroy methods of ObjcMethodDecl and ObjCInterfaceDecl which recursively
destroy their owned Decls and Stmts. There are a few cases where it is not
clear what to do (FIXMEs included in the patch).
llvm-svn: 52050
2008-06-06 16:45:15 +00:00
Steve Naroff
cfdf6166fc
Support "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the only documentation I could find on it).
...
/* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>" - nisse@lysator.liu.se . */
This commit adds the parser magic. The type associated with <p> is still incorrect. Will discuss with Chris.
llvm-svn: 51972
2008-06-05 00:02:44 +00:00
Steve Naroff
d9c2607014
Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
...
llvm-svn: 51963
2008-06-04 20:36:13 +00:00
Steve Naroff
b877e2c3ca
Fix parser bug/FIXME with @catch .
...
<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch )
llvm-svn: 51895
2008-06-03 05:36:54 +00:00
Chris Lattner
fd2fe8270e
handle the full assignment-expression grammar when using an
...
objc message send in an initializer expression.
llvm-svn: 51882
2008-06-02 21:31:07 +00:00
Chris Lattner
a120a521a5
Fix a couple crashes on invalid input.
...
llvm-svn: 51622
2008-05-27 23:32:43 +00:00
Eli Friedman
3e113409cb
Implementation of gcc mode attribute; this is significant because
...
it fixes PR2204. Not too much to say about the implementation; it works
in a similar way to the vector size attribute.
At some point, we need to modify the targets to provide information
about the appropriate types.
llvm-svn: 51577
2008-05-27 03:33:27 +00:00
Steve Naroff
4c290c7c0b
Make sure the source location for @property points the the @-sign (not the decl spec).
...
Also added a FIXME related to how we represent @properties in the ObjCInterfaceDecl AST.
llvm-svn: 51450
2008-05-22 23:24:08 +00:00
Eli Friedman
2460b0c941
Fix the scope of K&R-style argument declarations so that they don't
...
extend beyond the end of the function.
I'm not completely sure this is the right way to fix this bug, so
someone familiar with the parser should double-check.
llvm-svn: 51311
2008-05-20 09:10:20 +00:00
Argyrios Kyrtzidis
fa8e15bfa5
-Implement proper name lookup for namespaces.
...
-identifierResolver exposes an iterator interface to get all decls through the scope chain.
-The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier.
llvm-svn: 50923
2008-05-09 23:39:43 +00:00
Chris Lattner
2fdcddd78d
Don't call into objc front-end when not parsing objc code. This avoids
...
crashes because objc types aren't set up right.
llvm-svn: 50884
2008-05-09 05:28:21 +00:00
Fariborz Jahanian
ec6e4c8096
This patch introduces declaration of getter methods for ObjC2's
...
properties. Couple of property tests will fail with this patch.
Will fix them next.
llvm-svn: 50818
2008-05-07 17:43:59 +00:00
Fariborz Jahanian
09367d68ff
Patch to refactor setter/getter names of property attributes into Selector
...
(was IdentifierInfo * before). This will make method declartations whole
lot easier.
llvm-svn: 50747
2008-05-06 18:09:04 +00:00