diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-24 22:12:16 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-24 22:12:16 +0000 |
commit | 4cc18a4d5222e04bd568b1e3e4d86127dbbcdf3f (patch) | |
tree | 64ba80f8bf12837a3a31ea24a4e5fc0acce67ccb /lib/Parse/ParseExprCXX.cpp | |
parent | 8fdf32822be2238aa7db62d40e75b168b637ab7d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index a71eb4807b..93eaa2dedd 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -103,3 +103,19 @@ Parser::ExprResult Parser::ParseThrowExpression() { return Actions.ActOnCXXThrow(ThrowLoc, Expr.Val); } } + +/// ParseCXXThis - This handles the C++ 'this' pointer. +/// +/// C++ 9.3.2: In the body of a non-static member function, the keyword this is +/// a non-lvalue expression whose value is the address of the object for which +/// the function is called. +Parser::ExprResult Parser::ParseCXXThis() { + assert(Tok.is(tok::kw_this) && "Not 'this'!"); + SourceLocation ThisLoc = ConsumeToken(); + + ExprResult Res = Actions.ActOnCXXThis(ThisLoc); + if (Res.isInvalid) + return Res; + + return ParsePostfixExpressionSuffix(Res); +} |