diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 4ef1fe542ea54..92a6f218a0d0f 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -2153,7 +2153,7 @@ class Sema final { SourceLocation Loc); QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc); - TypeSourceInfo *GetTypeForDeclarator(Declarator &D, Scope *S); + TypeSourceInfo *GetTypeForDeclarator(Declarator &D); TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &D, QualType FromTy); /// Package the given type and TSI into a ParsedType. @@ -2194,7 +2194,7 @@ class Sema final { SourceLocation TargetLoc, const FunctionProtoType *Source, bool SkipSourceFirstParameter, SourceLocation SourceLoc); - TypeResult ActOnTypeName(Scope *S, Declarator &D); + TypeResult ActOnTypeName(Declarator &D); /// The parser has parsed the context-sensitive type 'instancetype' /// in an Objective-C message declaration. Return the appropriate type. diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 8d856cc2cf831..a106ce14c71f7 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -79,7 +79,7 @@ TypeResult Parser::ParseTypeName(SourceRange *Range, DeclaratorContext Context, if (DeclaratorInfo.isInvalidType()) return true; - return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + return Actions.ActOnTypeName(DeclaratorInfo); } /// Normalizes an attribute name by dropping prefixed and suffixed __. @@ -5011,7 +5011,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, DeclSpecContext::DSC_type_specifier); Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - BaseType = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + BaseType = Actions.ActOnTypeName(DeclaratorInfo); BaseRange = SourceRange(ColonLoc, DeclaratorInfo.getSourceRange().getEnd()); diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 5576be9e717a9..c0d771dc93dae 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1290,7 +1290,7 @@ TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + return Actions.ActOnTypeName(DeclaratorInfo); } // Check whether we have a template-id that names a type. @@ -1385,7 +1385,7 @@ TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + return Actions.ActOnTypeName(DeclaratorInfo); } void Parser::ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs) { diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index dcfd290d39cc4..e862856a08ca1 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1243,8 +1243,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - TypeResult Ty = Actions.ActOnTypeName(getCurScope(), - DeclaratorInfo); + TypeResult Ty = Actions.ActOnTypeName(DeclaratorInfo); if (Ty.isInvalid()) break; @@ -1538,7 +1537,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - TypeResult Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + TypeResult Ty = Actions.ActOnTypeName(DeclaratorInfo); if (Ty.isInvalid()) break; @@ -3096,7 +3095,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, TypeResult Ty; { InMessageExpressionRAIIObject InMessage(*this, false); - Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + Ty = Actions.ActOnTypeName(DeclaratorInfo); } Result = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(), @@ -3111,7 +3110,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, TypeResult Ty; { InMessageExpressionRAIIObject InMessage(*this, false); - Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + Ty = Actions.ActOnTypeName(DeclaratorInfo); } return ParseCompoundLiteralExpression(Ty.get(), OpenLoc, RParenLoc); } @@ -3123,7 +3122,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, TypeResult Ty; { InMessageExpressionRAIIObject InMessage(*this, false); - Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + Ty = Actions.ActOnTypeName(DeclaratorInfo); } if(Ty.isInvalid()) { @@ -3170,7 +3169,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, TypeResult Ty; { InMessageExpressionRAIIObject InMessage(*this, false); - Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + Ty = Actions.ActOnTypeName(DeclaratorInfo); } CastTy = Ty.get(); return ExprResult(); diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index ef9ea6575205c..d61f414406f02 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -1916,7 +1916,7 @@ ExprResult Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) { Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::FunctionalCast); - ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get(); + ParsedType TypeRep = Actions.ActOnTypeName(DeclaratorInfo).get(); assert((Tok.is(tok::l_paren) || (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace))) @@ -2815,7 +2815,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, ParseDeclaratorInternal(D, /*DirectDeclParser=*/nullptr); // Finish up the type. - TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D); + TypeResult Ty = Actions.ActOnTypeName(D); if (Ty.isInvalid()) return true; @@ -3252,8 +3252,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) { ConstructorLParen = T.getOpenLocation(); if (Tok.isNot(tok::r_paren)) { auto RunSignatureHelp = [&]() { - ParsedType TypeRep = - Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get(); + ParsedType TypeRep = Actions.ActOnTypeName(DeclaratorInfo).get(); QualType PreferredType; // ActOnTypeName might adjust DeclaratorInfo and return a null type even // the passing DeclaratorInfo is valid, e.g. running SignatureHelp on @@ -4037,7 +4036,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, if (DeclaratorInfo.isInvalidType()) return ExprError(); - TypeResult Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + TypeResult Ty = Actions.ActOnTypeName(DeclaratorInfo); return ParseCompoundLiteralExpression(Ty.get(), Tracker.getOpenLocation(), Tracker.getCloseLocation()); diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index c0261c462b883..849fd1ac95a44 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -1332,7 +1332,7 @@ ParsedType Parser::ParseObjCTypeName(ObjCDeclSpec &DS, DS.getNullabilityLoc(), addedToDeclSpec); - TypeResult type = Actions.ActOnTypeName(getCurScope(), declarator); + TypeResult type = Actions.ActOnTypeName(declarator); if (!type.isInvalid()) Ty = type.get(); @@ -1747,7 +1747,7 @@ void Parser::parseObjCTypeArgsOrProtocolQualifiers( // Form a declarator to turn this into a type. Declarator D(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - TypeResult fullTypeArg = Actions.ActOnTypeName(getCurScope(), D); + TypeResult fullTypeArg = Actions.ActOnTypeName(D); if (fullTypeArg.isUsable()) { typeArgs.push_back(fullTypeArg.get()); if (!foundValidTypeId) { @@ -3024,7 +3024,7 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { // remainder of the class message. Declarator DeclaratorInfo(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - TypeResult Type = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); + TypeResult Type = Actions.ActOnTypeName(DeclaratorInfo); if (Type.isInvalid()) return true; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bd38298a1481f..b642f38fa628a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5803,7 +5803,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // Mock up a declarator. Declarator Dc(DS, ParsedAttributesView::none(), DeclaratorContext::Member); StorageClass SC = StorageClassSpecToVarDeclStorageClass(DS); - TypeSourceInfo *TInfo = GetTypeForDeclarator(Dc, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(Dc); assert(TInfo && "couldn't build declarator info for anonymous struct/union"); // Create a declaration for this anonymous struct/union. @@ -5900,7 +5900,7 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, // Mock up a declarator. Declarator Dc(DS, ParsedAttributesView::none(), DeclaratorContext::TypeName); - TypeSourceInfo *TInfo = GetTypeForDeclarator(Dc, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(Dc); assert(TInfo && "couldn't build declarator info for anonymous struct"); auto *ParentDecl = cast(CurContext); @@ -6438,7 +6438,7 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D, } } - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType R = TInfo->getType(); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, @@ -15072,7 +15072,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D, CheckFunctionOrTemplateParamDeclarator(S, D); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType parmDeclType = TInfo->getType(); // Check for redeclaration of parameters, e.g. int foo(int x, int x); @@ -18336,7 +18336,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, SourceLocation Loc = DeclStart; if (II) Loc = D.getIdentifierLoc(); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType T = TInfo->getType(); if (getLangOpts().CPlusPlus) { CheckExtraCXXDefaultArguments(D); @@ -18700,7 +18700,7 @@ Decl *Sema::ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, // FIXME: Unnamed fields can be handled in various different ways, for // example, unnamed unions inject all members into the struct namespace! - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType T = TInfo->getType(); if (BitWidth) { diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f229e734d06b2..a2ce96188b4f1 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -839,7 +839,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D, Diag(DS.getVolatileSpecLoc(), diag::warn_deprecated_volatile_structured_binding); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType R = TInfo->getType(); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, @@ -17011,7 +17011,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, /// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch /// handler. Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); bool Invalid = D.isInvalidType(); // Check for unexpanded parameter packs. @@ -17762,7 +17762,7 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, // for a TUK_Friend. Declarator TheDeclarator(DS, ParsedAttributesView::none(), DeclaratorContext::Member); - TypeSourceInfo *TSI = GetTypeForDeclarator(TheDeclarator, S); + TypeSourceInfo *TSI = GetTypeForDeclarator(TheDeclarator); QualType T = TSI->getType(); if (TheDeclarator.isInvalidType()) return nullptr; @@ -17827,7 +17827,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); SourceLocation Loc = D.getIdentifierLoc(); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); // C++ [class.friend]p1 // A friend of a class is a function or class.... @@ -19182,7 +19182,7 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record, } SourceLocation Loc = D.getIdentifierLoc(); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType T = TInfo->getType(); if (getLangOpts().CPlusPlus) { CheckExtraCXXDefaultArguments(D); diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index c3b95e168a605..bb0d0cd2030ba 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1623,7 +1623,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQualifiers( } // Convert this to a type. - return ActOnTypeName(S, D); + return ActOnTypeName(D); }; // Local function that updates the declaration specifiers with @@ -5211,7 +5211,7 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) { if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType ExceptionType = TInfo->getType(); VarDecl *New = BuildObjCExceptionDecl(TInfo, ExceptionType, diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 049fdae09bb18..1b7a6bef33606 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -16974,7 +16974,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, assert(ParamInfo.getContext() == DeclaratorContext::BlockLiteral); BlockScopeInfo *CurBlock = getCurBlock(); - TypeSourceInfo *Sig = GetTypeForDeclarator(ParamInfo, CurScope); + TypeSourceInfo *Sig = GetTypeForDeclarator(ParamInfo); QualType T = Sig->getType(); // FIXME: We should allow unexpanded parameter packs here, but that would, diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 4ae04358d5df7..c77a237064162 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1931,7 +1931,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, } } - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/nullptr); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType AllocType = TInfo->getType(); if (D.isInvalidType()) return ExprError(); diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index e7b6443c984c9..5b95bae567b72 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -916,7 +916,7 @@ static TypeSourceInfo *getLambdaType(Sema &S, LambdaIntroducer &Intro, } } - MethodTyInfo = S.GetTypeForDeclarator(ParamInfo, CurScope); + MethodTyInfo = S.GetTypeForDeclarator(ParamInfo); assert(MethodTyInfo && "no type from lambda-declarator"); // Check for unexpanded parameter packs in the method type. diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 22540af1cda8c..349c7fc9c91bd 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -180,7 +180,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, unsigned Attributes = ODS.getPropertyAttributes(); FD.D.setObjCWeakProperty((Attributes & ObjCPropertyAttribute::kind_weak) != 0); - TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D, S); + TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D); QualType T = TSI->getType(); if (!getOwnershipRule(Attributes)) { Attributes |= deducePropertyOwnershipFromType(*this, T); diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 365032c964212..217fcb979deea 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -7304,7 +7304,7 @@ void Sema::ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope( LookupOrdinaryName); LookupParsedName(Lookup, S, &D.getCXXScopeSpec()); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType FType = TInfo->getType(); bool IsConstexpr = @@ -22719,7 +22719,7 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareReductionDirectiveEnd( } TypeResult Sema::ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D) { - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType T = TInfo->getType(); if (D.isInvalidType()) return true; diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 80a48c268a648..c0dcbda1fd622 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1498,7 +1498,7 @@ NamedDecl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Position, SourceLocation EqualLoc, Expr *Default) { - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); // Check that we have valid decl-specifiers specified. auto CheckValidDeclSpecifiers = [this, &D] { @@ -10521,7 +10521,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, S = S->getParent(); // Determine the type of the declaration. - TypeSourceInfo *T = GetTypeForDeclarator(D, S); + TypeSourceInfo *T = GetTypeForDeclarator(D); QualType R = T->getType(); if (R.isNull()) return true; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 78702b41ab820..619acf92969fc 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -6070,7 +6070,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, /// /// 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) { +TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D) { // Determine the type of the declarator. Not all forms of declarator // have a type. @@ -6748,13 +6748,13 @@ void LocInfoType::getAsStringInternal(std::string &Str, " GetTypeFromParser"); } -TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) { +TypeResult Sema::ActOnTypeName(Declarator &D) { // C99 6.7.6: Type names have no identifier. This is already validated by // the parser. assert(D.getIdentifier() == nullptr && "Type name should have no identifier!"); - TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); + TypeSourceInfo *TInfo = GetTypeForDeclarator(D); QualType T = TInfo->getType(); if (D.isInvalidType()) return true;