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/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 526eed6..af958f1 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -1349,6 +1349,7 @@
     ForContext,          // Declaration within first part of a for loop.
     ConditionContext,    // Condition declaration in a C++ if/switch/while/for.
     TemplateParamContext,// Within a template parameter list.
+    CXXNewContext,       // C++ new-expression.
     CXXCatchContext,     // C++ catch exception-declaration
     BlockLiteralContext,  // Block literal declarator.
     TemplateTypeArgContext, // Template type argument.
@@ -1499,6 +1500,7 @@
     case PrototypeContext:
     case ObjCPrototypeContext:
     case TemplateParamContext:
+    case CXXNewContext:
     case CXXCatchContext:
     case BlockLiteralContext:
     case TemplateTypeArgContext:
@@ -1524,6 +1526,7 @@
       return true;
 
     case TypeNameContext:
+    case CXXNewContext:
     case AliasDeclContext:
     case AliasTemplateContext:
     case ObjCPrototypeContext:
@@ -1553,6 +1556,7 @@
     case TemplateParamContext:
     case CXXCatchContext:
     case TypeNameContext:
+    case CXXNewContext:
     case AliasDeclContext:
     case AliasTemplateContext:
     case BlockLiteralContext:
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index e2c8c45..2e51117 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -779,8 +779,7 @@
                                  SourceLocation Loc, DeclarationName Entity);
   QualType BuildParenType(QualType T);
 
-  TypeSourceInfo *GetTypeForDeclarator(Declarator &D, Scope *S,
-                                       bool AllowAutoInTypeName = false);
+  TypeSourceInfo *GetTypeForDeclarator(Declarator &D, Scope *S);
   TypeSourceInfo *GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
                                                TypeSourceInfo *ReturnTypeInfo);
   /// \brief Package the given type and TSI into a ParsedType.
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)