]> granicus.if.org Git - clang/commitdiff
Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameter
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 28 Jun 2011 03:01:23 +0000 (03:01 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 28 Jun 2011 03:01:23 +0000 (03:01 +0000)
from Sema::GetTypeForDeclarator. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133987 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/DeclSpec.h
include/clang/Sema/Sema.h
lib/Parse/ParseExprCXX.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaType.cpp

index 526eed659d8f3605a8d18e1b90d9fec62c81bab9..af958f16dae8caa6efe309907f14b596b7fbbc74 100644 (file)
@@ -1349,6 +1349,7 @@ public:
     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 @@ public:
     case PrototypeContext:
     case ObjCPrototypeContext:
     case TemplateParamContext:
+    case CXXNewContext:
     case CXXCatchContext:
     case BlockLiteralContext:
     case TemplateTypeArgContext:
@@ -1524,6 +1526,7 @@ public:
       return true;
 
     case TypeNameContext:
+    case CXXNewContext:
     case AliasDeclContext:
     case AliasTemplateContext:
     case ObjCPrototypeContext:
@@ -1553,6 +1556,7 @@ public:
     case TemplateParamContext:
     case CXXCatchContext:
     case TypeNameContext:
+    case CXXNewContext:
     case AliasDeclContext:
     case AliasTemplateContext:
     case BlockLiteralContext:
index e2c8c4569cdc69f3721170ee32819bbd6f6433b3..2e51117f26eabef98b6a2eba57896ac29fd00ff8 100644 (file)
@@ -779,8 +779,7 @@ public:
                                  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.
index 7af39aec5f9a56a0b7da7fea2fe7d0d276a589d9..662a5abe4e72c837a98d3f8b3be088bcd18acff8 100644 (file)
@@ -1748,7 +1748,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
 
   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();
index f116f93234a24eebe104f59c5e87c68182a027d6..100681df5e6394e4d46d315b25d852bf86c826d3 100644 (file)
@@ -828,8 +828,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
     }
   }
 
-  TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/0,
-                                               /*AllowAuto=*/true);
+  TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/0);
   QualType AllocType = TInfo->getType();
   if (D.isInvalidType())
     return ExprError();
index 629a1a86ac83ec389d10415563867e9989ef5055..fa18a32aaa647945de173e97830d6b8df37f35c5 100644 (file)
@@ -1721,8 +1721,7 @@ static void DiagnoseIgnoredQualifiers(unsigned Quals,
 ///
 /// 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 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
       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 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
     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 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
       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)