aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-03-24 22:27:57 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-03-24 22:27:57 +0000
commit50de12f5783b57c74fd30ebfa3945181313625ff (patch)
treecfa3b0dd1ca4ab29aebd1b216fd0ebba653aa063 /lib/Parse/ParseDecl.cpp
parent8d9aefcb479cf2d1a5e397114ed3e22429ab9ac0 (diff)
Parse deleted function definitions and hook them up to Doug's machinery.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 4649abad46..81685eb8ca 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -225,7 +225,7 @@ void Parser::FuzzyParseMicrosoftDeclSpec() {
/// [C++] namespace-definition
/// [C++] using-directive
/// [C++] using-declaration [TODO]
-// [C++0x] static_assert-declaration
+/// [C++0x] static_assert-declaration
/// others... [FIXME]
///
Parser::DeclTy *Parser::ParseDeclaration(unsigned Context) {
@@ -285,6 +285,11 @@ Parser::DeclTy *Parser::ParseSimpleDeclaration(unsigned Context) {
/// [C++] initializer:
/// [C++] '=' initializer-clause
/// [C++] '(' expression-list ')'
+/// [C++0x] '=' 'default' [TODO]
+/// [C++0x] '=' 'delete'
+///
+/// According to the standard grammar, =default and =delete are function
+/// definitions, but that definitely doesn't fit with the parser here.
///
Parser::DeclTy *Parser::
ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
@@ -322,12 +327,17 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Parse declarator '=' initializer.
if (Tok.is(tok::equal)) {
ConsumeToken();
- OwningExprResult Init(ParseInitializer());
- if (Init.isInvalid()) {
- SkipUntil(tok::semi);
- return 0;
+ if (getLang().CPlusPlus0x && Tok.is(tok::kw_delete)) {
+ SourceLocation DelLoc = ConsumeToken();
+ Actions.SetDeclDeleted(LastDeclInGroup, DelLoc);
+ } else {
+ OwningExprResult Init(ParseInitializer());
+ if (Init.isInvalid()) {
+ SkipUntil(tok::semi);
+ return 0;
+ }
+ Actions.AddInitializerToDecl(LastDeclInGroup, move(Init));
}
- Actions.AddInitializerToDecl(LastDeclInGroup, move(Init));
} else if (Tok.is(tok::l_paren)) {
// Parse C++ direct initializer: '(' expression-list ')'
SourceLocation LParenLoc = ConsumeParen();
@@ -2037,13 +2047,13 @@ void Parser::ParseParenDeclarator(Declarator &D) {
/// declaration-specifiers declarator
/// [C++] declaration-specifiers declarator '=' assignment-expression
/// [GNU] declaration-specifiers declarator attributes
-/// declaration-specifiers abstract-declarator[opt]
-/// [C++] declaration-specifiers abstract-declarator[opt]
+/// declaration-specifiers abstract-declarator[opt]
+/// [C++] declaration-specifiers abstract-declarator[opt]
/// '=' assignment-expression
/// [GNU] declaration-specifiers abstract-declarator[opt] attributes
///
/// For C++, after the parameter-list, it also parses "cv-qualifier-seq[opt]"
-/// and "exception-specification[opt]"(TODO).
+/// and "exception-specification[opt]".
///
void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
AttributeList *AttrList,