summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-24 22:12:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-24 22:12:16 +0000
commit7bbb20e33813596bcfd5538510a8de0b7c8d5f29 (patch)
treed77612d5b8e258e9b36b15440872855792721ffc /clang/lib/Parse/ParseExprCXX.cpp
parent5ceb8b676cab2d057a5c59a78c2cdacc17a77f4d (diff)
downloadbcm5719-llvm-7bbb20e33813596bcfd5538510a8de0b7c8d5f29.tar.gz
bcm5719-llvm-7bbb20e33813596bcfd5538510a8de0b7c8d5f29.zip
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
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