TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can
only be called when they might be needed now, so make them assert
that their current token is :: or identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61662 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index f951435..a4b97e1 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -35,7 +35,7 @@
bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS,
const Token *GlobalQualifier) {
assert(getLang().CPlusPlus &&
- "Call sites of this function should be guarded by checking for C++.");
+ "Call sites of this function should be guarded by checking for C++");
if (Tok.is(tok::annot_cxxscope)) {
assert(GlobalQualifier == 0 &&
@@ -183,13 +183,13 @@
case tok::kw_operator: {
SourceLocation OperatorLoc = Tok.getLocation();
- if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) {
+ if (OverloadedOperatorKind Op = TryParseOperatorFunctionId())
return Owned(Actions.ActOnCXXOperatorFunctionIdExpr(
CurScope, OperatorLoc, Op, Tok.is(tok::l_paren), SS));
- } else if (TypeTy *Type = ParseConversionFunctionId()) {
- return Owned(Actions.ActOnCXXConversionFunctionExpr(
- CurScope, OperatorLoc, Type, Tok.is(tok::l_paren),SS));
- }
+ if (TypeTy *Type = ParseConversionFunctionId())
+ return Owned(Actions.ActOnCXXConversionFunctionExpr(CurScope, OperatorLoc,
+ Type,
+ Tok.is(tok::l_paren), SS));
// We already complained about a bad conversion-function-id,
// above.