Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary expression. Remove CXXThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58695 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 33fc52b..e4321f5 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -46,7 +46,7 @@
bool VisitExpr(Expr *Node);
bool VisitDeclRefExpr(DeclRefExpr *DRE);
- bool VisitPredefinedExpr(PredefinedExpr *PE);
+ bool VisitCXXThisExpr(CXXThisExpr *ThisE);
};
/// VisitExpr - Visit all of the children of this expression.
@@ -88,18 +88,14 @@
return false;
}
- /// VisitPredefinedExpr - Visit a predefined expression, which could
- /// refer to "this".
- bool CheckDefaultArgumentVisitor::VisitPredefinedExpr(PredefinedExpr *PE) {
- if (PE->getIdentType() == PredefinedExpr::CXXThis) {
- // C++ [dcl.fct.default]p8:
- // The keyword this shall not be used in a default argument of a
- // member function.
- return S->Diag(PE->getSourceRange().getBegin(),
- diag::err_param_default_argument_references_this,
- PE->getSourceRange());
- }
- return false;
+ /// VisitCXXThisExpr - Visit a C++ "this" expression.
+ bool CheckDefaultArgumentVisitor::VisitCXXThisExpr(CXXThisExpr *ThisE) {
+ // C++ [dcl.fct.default]p8:
+ // The keyword this shall not be used in a default argument of a
+ // member function.
+ return S->Diag(ThisE->getSourceRange().getBegin(),
+ diag::err_param_default_argument_references_this,
+ ThisE->getSourceRange());
}
}