r291608 - Remove a couple of parameters that are always false.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 14:59:19 PST 2017
Author: rsmith
Date: Tue Jan 10 16:59:18 2017
New Revision: 291608
URL: http://llvm.org/viewvc/llvm-project?rev=291608&view=rev
Log:
Remove a couple of parameters that are always false.
Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=291608&r1=291607&r2=291608&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Jan 10 16:59:18 2017
@@ -600,11 +600,8 @@ private:
public:
// If NeedType is true, then TryAnnotateTypeOrScopeToken will try harder to
// find a type name by attempting typo correction.
- bool TryAnnotateTypeOrScopeToken(bool EnteringContext = false,
- bool NeedType = false);
- bool TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool EnteringContext,
- bool NeedType,
- CXXScopeSpec &SS,
+ bool TryAnnotateTypeOrScopeToken();
+ bool TryAnnotateTypeOrScopeTokenAfterScopeSpec(CXXScopeSpec &SS,
bool IsNewScope);
bool TryAnnotateCXXScopeToken(bool EnteringContext = false);
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=291608&r1=291607&r2=291608&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Jan 10 16:59:18 2017
@@ -1472,8 +1472,7 @@ Parser::TryAnnotateName(bool IsAddressOf
return ANK_Error;
if (Tok.isNot(tok::identifier) || SS.isInvalid()) {
- if (TryAnnotateTypeOrScopeTokenAfterScopeSpec(EnteringContext, false, SS,
- !WasScopeAnnotation))
+ if (TryAnnotateTypeOrScopeTokenAfterScopeSpec(SS, !WasScopeAnnotation))
return ANK_Error;
return ANK_Unresolved;
}
@@ -1486,8 +1485,7 @@ Parser::TryAnnotateName(bool IsAddressOf
if (isTentativelyDeclared(Name)) {
// Identifier has been tentatively declared, and thus cannot be resolved as
// an expression. Fall back to annotating it as a type.
- if (TryAnnotateTypeOrScopeTokenAfterScopeSpec(EnteringContext, false, SS,
- !WasScopeAnnotation))
+ if (TryAnnotateTypeOrScopeTokenAfterScopeSpec(SS, !WasScopeAnnotation))
return ANK_Error;
return Tok.is(tok::annot_typename) ? ANK_Success : ANK_TentativeDecl;
}
@@ -1625,7 +1623,7 @@ bool Parser::TryKeywordIdentFallback(boo
///
/// Note that this routine emits an error if you call it with ::new or ::delete
/// as the current tokens, so only call it in contexts where these are invalid.
-bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) {
+bool Parser::TryAnnotateTypeOrScopeToken() {
assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope) ||
Tok.is(tok::kw_decltype) || Tok.is(tok::annot_template_id) ||
@@ -1642,7 +1640,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
if (getLangOpts().MSVCCompat && NextToken().is(tok::kw_typedef)) {
Token TypedefToken;
PP.Lex(TypedefToken);
- bool Result = TryAnnotateTypeOrScopeToken(EnteringContext, NeedType);
+ bool Result = TryAnnotateTypeOrScopeToken();
PP.EnterToken(Tok);
Tok = TypedefToken;
if (!Result)
@@ -1667,8 +1665,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
Tok.is(tok::annot_decltype)) {
// Attempt to recover by skipping the invalid 'typename'
if (Tok.is(tok::annot_decltype) ||
- (!TryAnnotateTypeOrScopeToken(EnteringContext, NeedType) &&
- Tok.isAnnotation())) {
+ (!TryAnnotateTypeOrScopeToken() && Tok.isAnnotation())) {
unsigned DiagID = diag::err_expected_qualified_after_typename;
// MS compatibility: MSVC permits using known types with typename.
// e.g. "typedef typename T* pointer_type"
@@ -1728,19 +1725,16 @@ bool Parser::TryAnnotateTypeOrScopeToken
CXXScopeSpec SS;
if (getLangOpts().CPlusPlus)
- if (ParseOptionalCXXScopeSpecifier(SS, nullptr, EnteringContext))
+ if (ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext*/false))
return true;
- return TryAnnotateTypeOrScopeTokenAfterScopeSpec(EnteringContext, NeedType,
- SS, !WasScopeAnnotation);
+ return TryAnnotateTypeOrScopeTokenAfterScopeSpec(SS, !WasScopeAnnotation);
}
/// \brief Try to annotate a type or scope token, having already parsed an
/// optional scope specifier. \p IsNewScope should be \c true unless the scope
/// specifier was extracted from an existing tok::annot_cxxscope annotation.
-bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool EnteringContext,
- bool NeedType,
- CXXScopeSpec &SS,
+bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(CXXScopeSpec &SS,
bool IsNewScope) {
if (Tok.is(tok::identifier)) {
IdentifierInfo *CorrectedII = nullptr;
@@ -1749,8 +1743,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
*Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), &SS,
false, NextToken().is(tok::period), nullptr,
/*IsCtorOrDtorName=*/false,
- /*NonTrivialTypeSourceInfo*/ true,
- NeedType ? &CorrectedII : nullptr)) {
+ /*NonTrivialTypeSourceInfo*/ true)) {
// A FixIt was applied as a result of typo correction
if (CorrectedII)
Tok.setIdentifierInfo(CorrectedII);
@@ -1803,11 +1796,11 @@ bool Parser::TryAnnotateTypeOrScopeToken
UnqualifiedId TemplateName;
TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
bool MemberOfUnknownSpecialization;
- if (TemplateNameKind TNK =
- Actions.isTemplateName(getCurScope(), SS,
- /*hasTemplateKeyword=*/false, TemplateName,
- /*ObjectType=*/nullptr, EnteringContext,
- Template, MemberOfUnknownSpecialization)) {
+ if (TemplateNameKind TNK = Actions.isTemplateName(
+ getCurScope(), SS,
+ /*hasTemplateKeyword=*/false, TemplateName,
+ /*ObjectType=*/nullptr, /*EnteringContext*/false, Template,
+ MemberOfUnknownSpecialization)) {
// Consume the identifier.
ConsumeToken();
if (AnnotateTemplateIdToken(Template, TNK, SS, SourceLocation(),
More information about the cfe-commits
mailing list