Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameter
from Sema::GetTypeForDeclarator. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133987 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 7af39ae..662a5ab 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -1748,7 +1748,7 @@
SourceRange TypeIdParens;
DeclSpec DS(AttrFactory);
- Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
+ Declarator DeclaratorInfo(DS, Declarator::CXXNewContext);
if (Tok.is(tok::l_paren)) {
// If it turns out to be a placement, we change the type location.
PlacementLParen = ConsumeParen();
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index f116f93..100681d 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -828,8 +828,7 @@
}
}
- TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/0,
- /*AllowAuto=*/true);
+ TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/0);
QualType AllocType = TInfo->getType();
if (D.isInvalidType())
return ExprError();
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 629a1a8..fa18a32 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1721,8 +1721,7 @@
///
/// The result of this call will never be null, but the associated
/// type may be a null type if there's an unrecoverable error.
-TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
- bool AutoAllowedInTypeName) {
+TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
// Determine the type of the declarator. Not all forms of declarator
// have a type.
QualType T;
@@ -1820,13 +1819,13 @@
Error = 9; // Type alias
break;
case Declarator::TypeNameContext:
- if (!AutoAllowedInTypeName)
- Error = 11; // Generic
+ Error = 11; // Generic
break;
case Declarator::FileContext:
case Declarator::BlockContext:
case Declarator::ForContext:
case Declarator::ConditionContext:
+ case Declarator::CXXNewContext:
break;
}
@@ -2434,6 +2433,7 @@
case Declarator::KNRTypeListContext:
case Declarator::ObjCPrototypeContext: // FIXME: special diagnostic here?
case Declarator::TypeNameContext:
+ case Declarator::CXXNewContext:
case Declarator::AliasDeclContext:
case Declarator::AliasTemplateContext:
case Declarator::MemberContext:
@@ -2478,6 +2478,7 @@
break;
case Declarator::TypeNameContext:
case Declarator::TemplateParamContext:
+ case Declarator::CXXNewContext:
case Declarator::CXXCatchContext:
case Declarator::TemplateTypeArgContext:
Diag(OwnedTagDecl->getLocation(),diag::err_type_defined_in_type_specifier)