summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index a71eb4807b2..93eaa2dedd9 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/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);
+}
OpenPOWER on IntegriCloud