diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-02-03 20:19:35 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-02-03 20:19:35 +0000 |
commit | ebc07d57be9e0722b4b9c66625e1fca43dcc2ee0 (patch) | |
tree | 56b421d555ac9fa1a897311d89cd18f37995651b /lib/Parse/ParseExprCXX.cpp | |
parent | 59e5a0e4f1b3a6f4ddcb0e902e98d8b3c9d10799 (diff) |
Allow taking the address of data members, resulting in a member pointer.
Pointers to functions don't work yet, and pointers to overloaded functions even less. Also, far too much illegal code is accepted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index f434cfb1f7..1efa274083 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -131,7 +131,12 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS) { /// That way Sema can handle and report similar errors for namespaces and the /// global scope. /// -Parser::OwningExprResult Parser::ParseCXXIdExpression() { +/// The isAddressOfOperand parameter indicates that this id-expression is a +/// direct operand of the address-of operator. This is, besides member contexts, +/// the only place where a qualified-id naming a non-static class member may +/// appear. +/// +Parser::OwningExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) { // qualified-id: // '::'[opt] nested-name-specifier 'template'[opt] unqualified-id // '::' unqualified-id @@ -154,18 +159,20 @@ Parser::OwningExprResult Parser::ParseCXXIdExpression() { // Consume the identifier so that we can see if it is followed by a '('. IdentifierInfo &II = *Tok.getIdentifierInfo(); SourceLocation L = ConsumeToken(); - return Actions.ActOnIdentifierExpr(CurScope, L, II, - Tok.is(tok::l_paren), &SS); + return Actions.ActOnIdentifierExpr(CurScope, L, II, Tok.is(tok::l_paren), + &SS, isAddressOfOperand); } case tok::kw_operator: { SourceLocation OperatorLoc = Tok.getLocation(); if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) return Actions.ActOnCXXOperatorFunctionIdExpr( - CurScope, OperatorLoc, Op, Tok.is(tok::l_paren), SS); + CurScope, OperatorLoc, Op, Tok.is(tok::l_paren), SS, + isAddressOfOperand); if (TypeTy *Type = ParseConversionFunctionId()) return Actions.ActOnCXXConversionFunctionExpr(CurScope, OperatorLoc, Type, - Tok.is(tok::l_paren), SS); + Tok.is(tok::l_paren), SS, + isAddressOfOperand); // We already complained about a bad conversion-function-id, // above. |