ActOnPseudoDestructorExpr now performs all semantic analysis for
pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr
node directly. Currently, this only affects pseudo-destructor
expressions when they are parsed, but not after template
instantiation. That's coming next...
Improve parsing of pseudo-destructor-names. When parsing the
nested-name-specifier and we hit the sequence of tokens X :: ~, query
the actual module to determine whether X is a type-name (in which case
the X :: is part of the pseudo-destructor-name but not the
nested-name-specifier) or not (in which case the X :: is part of the
nested-name-specifier).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97058 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 24edd72..c3116a3 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3178,23 +3178,6 @@
return ExprError();
}
-static Sema::OwningExprResult DiagnoseDtorReference(Sema &SemaRef,
- SourceLocation NameLoc,
- Sema::ExprArg MemExpr) {
- Expr *E = (Expr *) MemExpr.get();
- SourceLocation ExpectedLParenLoc = SemaRef.PP.getLocForEndOfToken(NameLoc);
- SemaRef.Diag(E->getLocStart(), diag::err_dtor_expr_without_call)
- << isa<CXXPseudoDestructorExpr>(E)
- << CodeModificationHint::CreateInsertion(ExpectedLParenLoc, "()");
-
- return SemaRef.ActOnCallExpr(/*Scope*/ 0,
- move(MemExpr),
- /*LPLoc*/ ExpectedLParenLoc,
- Sema::MultiExprArg(SemaRef, 0, 0),
- /*CommaLocs*/ 0,
- /*RPLoc*/ ExpectedLParenLoc);
-}
-
/// The main callback when the parser finds something like
/// expression . [nested-name-specifier] identifier
/// expression -> [nested-name-specifier] identifier
@@ -3265,7 +3248,7 @@
// call now.
if (!HasTrailingLParen &&
Id.getKind() == UnqualifiedId::IK_DestructorName)
- return DiagnoseDtorReference(*this, NameLoc, move(Result));
+ return DiagnoseDtorReference(NameLoc, move(Result));
return move(Result);
}