diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -1603,14 +1603,17 @@ //===--------------------------------------------------------------------===// // C99 6.9: External Definitions. DeclGroupPtrTy ParseExternalDeclaration(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs, ParsingDeclSpec *DS = nullptr); bool isDeclarationAfterDeclarator(); bool isStartOfFunctionDefinition(const ParsingDeclarator &Declarator); DeclGroupPtrTy ParseDeclarationOrFunctionDefinition(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs, ParsingDeclSpec *DS = nullptr, AccessSpecifier AS = AS_none); DeclGroupPtrTy ParseDeclOrFunctionDefInternal(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs, ParsingDeclSpec &DS, AccessSpecifier AS); @@ -1625,7 +1628,8 @@ // Objective-C External Declarations void MaybeSkipAttributes(tok::ObjCKeywordKind Kind); - DeclGroupPtrTy ParseObjCAtDirectives(ParsedAttributes &Attrs); + DeclGroupPtrTy ParseObjCAtDirectives(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs); DeclGroupPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc); Decl *ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc, ParsedAttributes &prefixAttrs); diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -256,7 +256,8 @@ Tok.isNot(tok::eof)) { ParsedAttributes Attrs(AttrFactory); MaybeParseCXX11Attributes(Attrs); - ParseExternalDeclaration(Attrs); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); } // The caller is what called check -- we are simply calling @@ -359,6 +360,7 @@ ParsedAttributes DeclAttrs(AttrFactory); MaybeParseCXX11Attributes(DeclAttrs); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); if (Tok.isNot(tok::l_brace)) { // Reset the source range in DS, as the leading "extern" @@ -367,7 +369,7 @@ DS.SetRangeEnd(SourceLocation()); // ... but anyway remember that such an "extern" was seen. DS.setExternInLinkageSpec(true); - ParseExternalDeclaration(DeclAttrs, &DS); + ParseExternalDeclaration(DeclAttrs, EmptyDeclSpecAttrs, &DS); return LinkageSpec ? Actions.ActOnFinishLinkageSpecification( getCurScope(), LinkageSpec, SourceLocation()) : nullptr; @@ -409,7 +411,7 @@ default: ParsedAttributes Attrs(AttrFactory); MaybeParseCXX11Attributes(Attrs); - ParseExternalDeclaration(Attrs); + ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); continue; } @@ -441,7 +443,8 @@ // FIXME: Factor out a ParseExternalDeclarationWithAttrs. ParsedAttributes Attrs(AttrFactory); MaybeParseCXX11Attributes(Attrs); - ParseExternalDeclaration(Attrs); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); return Actions.ActOnFinishExportDecl(getCurScope(), ExportDecl, SourceLocation()); } @@ -460,7 +463,8 @@ Tok.isNot(tok::eof)) { ParsedAttributes Attrs(AttrFactory); MaybeParseCXX11Attributes(Attrs); - ParseExternalDeclaration(Attrs); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); } T.consumeClose(); diff --git a/clang/lib/Parse/ParseHLSL.cpp b/clang/lib/Parse/ParseHLSL.cpp --- a/clang/lib/Parse/ParseHLSL.cpp +++ b/clang/lib/Parse/ParseHLSL.cpp @@ -78,8 +78,9 @@ while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { // FIXME: support attribute on constants inside cbuffer/tbuffer. ParsedAttributes Attrs(AttrFactory); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); - DeclGroupPtrTy Result = ParseExternalDeclaration(Attrs); + DeclGroupPtrTy Result = ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); if (!validateDeclsInsideHLSLBuffer(Result, IdentifierLoc, IsCBuffer, *this)) { T.skipToEnd(); diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -45,7 +45,11 @@ /// [OBJC] objc-protocol-definition /// [OBJC] objc-method-definition /// [OBJC] '@' 'end' -Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives(ParsedAttributes &Attrs) { +Parser::DeclGroupPtrTy +Parser::ParseObjCAtDirectives(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs) { + Attrs.takeAllFrom(DeclSpecAttrs); + SourceLocation AtLoc = ConsumeToken(); // the "@" if (Tok.is(tok::code_completion)) { @@ -54,6 +58,17 @@ return nullptr; } + switch (Tok.getObjCKeywordID()) { + case tok::objc_interface: + case tok::objc_protocol: + case tok::objc_implementation: + break; + default: + for (const auto &PA : Attrs) + if (PA.isGNUAttribute()) + Diag(PA.getLoc(), diag::err_objc_unexpected_attr); + } + Decl *SingleDecl = nullptr; switch (Tok.getObjCKeywordID()) { case tok::objc_class: @@ -651,6 +666,7 @@ break; ParsedAttributes EmptyAttrs(AttrFactory); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); // Since we call ParseDeclarationOrFunctionDefinition() instead of // ParseExternalDeclaration() below (so that this doesn't parse nested @@ -664,7 +680,7 @@ } allTUVariables.push_back( - ParseDeclarationOrFunctionDefinition(EmptyAttrs)); + ParseDeclarationOrFunctionDefinition(EmptyAttrs, EmptyDeclSpecAttrs)); continue; } @@ -2225,7 +2241,8 @@ while (!ObjCImplParsing.isFinished() && !isEofOrEom()) { ParsedAttributes attrs(AttrFactory); MaybeParseCXX11Attributes(attrs); - if (DeclGroupPtrTy DGP = ParseExternalDeclaration(attrs)) { + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + if (DeclGroupPtrTy DGP = ParseExternalDeclaration(attrs, EmptyDeclSpecAttrs)) { DeclGroupRef DG = DGP.get(); DeclsInGroup.append(DG.begin(), DG.end()); } diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -1994,6 +1994,8 @@ ParsingOpenMPDirectiveRAII DirScope(*this); ParenBraceBracketBalancer BalancerRAIIObj(*this); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + SourceLocation Loc; OpenMPDirectiveKind DKind; if (Delayed) { @@ -2247,7 +2249,7 @@ assert(TagType == DeclSpec::TST_unspecified); MaybeParseCXX11Attributes(Attrs); ParsingDeclSpec PDS(*this); - Ptr = ParseExternalDeclaration(Attrs, &PDS); + Ptr = ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs, &PDS); } else { Ptr = ParseCXXClassMemberDeclarationWithPragmas(AS, Attrs, TagType, Tag); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -732,9 +732,12 @@ } ParsedAttributes attrs(AttrFactory); - MaybeParseCXX11Attributes(attrs); + ParsedAttributes DeclSpecAttrs(AttrFactory); + while (MaybeParseCXX11Attributes(attrs) || + MaybeParseGNUAttributes(DeclSpecAttrs)) + ; - Result = ParseExternalDeclaration(attrs); + Result = ParseExternalDeclaration(attrs, DeclSpecAttrs); // An empty Result might mean a line with ';' or some parsing error, ignore // it. if (Result) { @@ -777,8 +780,10 @@ /// /// [Modules-TS] module-import-declaration /// -Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(ParsedAttributes &Attrs, - ParsingDeclSpec *DS) { +Parser::DeclGroupPtrTy +Parser::ParseExternalDeclaration(ParsedAttributes &Attrs, + ParsedAttributes &DeclSpecAttrs, + ParsingDeclSpec *DS) { DestroyTemplateIdAnnotationsRAIIObj CleanupRAII(*this); ParenBraceBracketBalancer BalancerRAIIObj(*this); @@ -866,7 +871,7 @@ // __extension__ silences extension warnings in the subexpression. ExtensionRAIIObject O(Diags); // Use RAII to do this. ConsumeToken(); - return ParseExternalDeclaration(Attrs); + return ParseExternalDeclaration(Attrs, DeclSpecAttrs); } case tok::kw_asm: { ProhibitAttributes(Attrs); @@ -894,7 +899,7 @@ break; } case tok::at: - return ParseObjCAtDirectives(Attrs); + return ParseObjCAtDirectives(Attrs, DeclSpecAttrs); case tok::minus: case tok::plus: if (!getLangOpts().ObjC) { @@ -942,18 +947,16 @@ // A function definition cannot start with any of these keywords. { SourceLocation DeclEnd; - ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); return ParseDeclaration(DeclaratorContext::File, DeclEnd, Attrs, - EmptyDeclSpecAttrs); + DeclSpecAttrs); } case tok::kw_cbuffer: case tok::kw_tbuffer: if (getLangOpts().HLSL) { SourceLocation DeclEnd; - ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); return ParseDeclaration(DeclaratorContext::File, DeclEnd, Attrs, - EmptyDeclSpecAttrs); + DeclSpecAttrs); } goto dont_know; @@ -964,9 +967,8 @@ Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) << 0; SourceLocation DeclEnd; - ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); return ParseDeclaration(DeclaratorContext::File, DeclEnd, Attrs, - EmptyDeclSpecAttrs); + DeclSpecAttrs); } goto dont_know; @@ -977,9 +979,8 @@ // Inline namespaces. Allowed as an extension even in C++03. if (NextKind == tok::kw_namespace) { SourceLocation DeclEnd; - ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); return ParseDeclaration(DeclaratorContext::File, DeclEnd, Attrs, - EmptyDeclSpecAttrs); + DeclSpecAttrs); } // Parse (then ignore) 'inline' prior to a template instantiation. This is @@ -988,9 +989,8 @@ Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) << 1; SourceLocation DeclEnd; - ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); return ParseDeclaration(DeclaratorContext::File, DeclEnd, Attrs, - EmptyDeclSpecAttrs); + DeclSpecAttrs); } } goto dont_know; @@ -1026,7 +1026,7 @@ return nullptr; } // We can't tell whether this is a function-definition or declaration yet. - return ParseDeclarationOrFunctionDefinition(Attrs, DS); + return ParseDeclarationOrFunctionDefinition(Attrs, DeclSpecAttrs, DS); } // This routine returns a DeclGroup, if the thing we parsed only contains a @@ -1091,7 +1091,10 @@ /// [OMP] allocate-directive [TODO] /// Parser::DeclGroupPtrTy Parser::ParseDeclOrFunctionDefInternal( - ParsedAttributes &Attrs, ParsingDeclSpec &DS, AccessSpecifier AS) { + ParsedAttributes &Attrs, ParsedAttributes &DeclSpecAttrs, + ParsingDeclSpec &DS, AccessSpecifier AS) { + DS.takeAttributesFrom(DeclSpecAttrs); + MaybeParseMicrosoftAttributes(DS.getAttributes()); // Parse the common declaration-specifiers piece. ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS, @@ -1190,9 +1193,10 @@ } Parser::DeclGroupPtrTy Parser::ParseDeclarationOrFunctionDefinition( - ParsedAttributes &Attrs, ParsingDeclSpec *DS, AccessSpecifier AS) { + ParsedAttributes &Attrs, ParsedAttributes &DeclSpecAttrs, + ParsingDeclSpec *DS, AccessSpecifier AS) { if (DS) { - return ParseDeclOrFunctionDefInternal(Attrs, *DS, AS); + return ParseDeclOrFunctionDefInternal(Attrs, DeclSpecAttrs, *DS, AS); } else { ParsingDeclSpec PDS(*this); // Must temporarily exit the objective-c container scope for @@ -1200,7 +1204,7 @@ // afterwards. ObjCDeclContextSwitch ObjCDC(*this); - return ParseDeclOrFunctionDefInternal(Attrs, PDS, AS); + return ParseDeclOrFunctionDefInternal(Attrs, DeclSpecAttrs, PDS, AS); } } @@ -2342,7 +2346,8 @@ while (Tok.isNot(tok::r_brace) && !isEofOrEom()) { ParsedAttributes Attrs(AttrFactory); MaybeParseCXX11Attributes(Attrs); - DeclGroupPtrTy Result = ParseExternalDeclaration(Attrs); + ParsedAttributes EmptyDeclSpecAttrs(AttrFactory); + DeclGroupPtrTy Result = ParseExternalDeclaration(Attrs, EmptyDeclSpecAttrs); if (Result && !getCurScope()->getParent()) Actions.getASTConsumer().HandleTopLevelDecl(Result.get()); } diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant-varying-return.c b/clang/test/AST/ast-dump-openmp-begin-declare-variant-varying-return.c --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant-varying-return.c +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant-varying-return.c @@ -78,44 +78,44 @@ // C_FLOAT-NEXT: | | `-ImplicitCastExpr [[ADDR_3:0x[a-z0-9]*]] 'float' // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_4:0x[a-z0-9]*]] 'int' 0 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_5:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_6:0x[a-z0-9]*]] line:32:11 used also_before 'float (int)' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_6:0x[a-z0-9]*]] line:32:11 used also_before 'float (int)' // C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_7:0x[a-z0-9]*]] col:27 i 'int' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_8:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_9:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ImplicitCastExpr [[ADDR_10:0x[a-z0-9]*]] 'float' // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_11:0x[a-z0-9]*]] 'int' 0 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_12:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_13:0x[a-z0-9]*]] line:10:22 also_before[implementation={extension(disable_implicit_base)}] 'int ({{.*}})' -// C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_14:0x[a-z0-9]*]] +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_13:0x[a-z0-9]*]] line:38:1 also_before[implementation={extension(disable_implicit_base)}] 'int ({{.*}})' +// C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_14:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_15:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_16:0x[a-z0-9]*]] 'int' 1 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_17:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_18:0x[a-z0-9]*]] line:10:22 also_before[implementation={extension(disable_implicit_base)}] 'int (int)' -// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_19:0x[a-z0-9]*]] col:21 i 'int' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_18:0x[a-z0-9]*]] line:42:1 also_before[implementation={extension(disable_implicit_base)}] 'int (int)' +// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_19:0x[a-z0-9]*]] col:21 i 'int' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_20:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_21:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_22:0x[a-z0-9]*]] 'int' 1 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_23:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_24:0x[a-z0-9]*]] line:10:22 also_after[implementation={extension(disable_implicit_base)}] 'int (double)' -// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_25:0x[a-z0-9]*]] col:23 d 'double' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_24:0x[a-z0-9]*]] line:47:1 also_after[implementation={extension(disable_implicit_base)}] 'int (double)' +// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_25:0x[a-z0-9]*]] col:23 d 'double' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_26:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_27:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_28:0x[a-z0-9]*]] 'int' 0 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_29:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_30:0x[a-z0-9]*]] line:10:22 also_after[implementation={extension(disable_implicit_base)}] 'int (long)' -// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_31:0x[a-z0-9]*]] col:21 l 'long' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_30:0x[a-z0-9]*]] line:51:1 also_after[implementation={extension(disable_implicit_base)}] 'int (long)' +// C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_31:0x[a-z0-9]*]] col:21 l 'long' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_32:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_33:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_34:0x[a-z0-9]*]] 'int' 0 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_35:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_36:0x[a-z0-9]*]] line:57:11 used also_after 'float (double)' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_36:0x[a-z0-9]*]] line:57:11 used also_after 'float (double)' // C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_37:0x[a-z0-9]*]] col:29 d 'double' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_38:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_39:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ImplicitCastExpr [[ADDR_40:0x[a-z0-9]*]] 'float' // C_FLOAT-NEXT: | | `-IntegerLiteral [[ADDR_41:0x[a-z0-9]*]] 'int' 1 // C_FLOAT-NEXT: | `-OverloadableAttr [[ADDR_42:0x[a-z0-9]*]] -// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_43:0x[a-z0-9]*]] line:61:11 used also_after 'float (long)' +// C_FLOAT-NEXT: |-FunctionDecl [[ADDR_43:0x[a-z0-9]*]] line:61:11 used also_after 'float (long)' // C_FLOAT-NEXT: | |-ParmVarDecl [[ADDR_44:0x[a-z0-9]*]] col:27 l 'long' // C_FLOAT-NEXT: | |-CompoundStmt [[ADDR_45:0x[a-z0-9]*]] // C_FLOAT-NEXT: | | `-ReturnStmt [[ADDR_46:0x[a-z0-9]*]] @@ -228,45 +228,45 @@ // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_3:0x[a-z0-9]*]] 'int' 1 // C_INT-NEXT: | |-OverloadableAttr [[ADDR_4:0x[a-z0-9]*]] // C_INT-NEXT: | `-OMPDeclareVariantAttr [[ADDR_5:0x[a-z0-9]*]] <> Implicit implementation={extension(disable_implicit_base)} -// C_INT-NEXT: | `-DeclRefExpr [[ADDR_6:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_7:0x[a-z0-9]*]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int ({{.*}})' -// C_INT-NEXT: |-FunctionDecl [[ADDR_8:0x[a-z0-9]*]] line:32:11 used also_before 'int (int)' +// C_INT-NEXT: | `-DeclRefExpr [[ADDR_6:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_7:0x[a-z0-9]*]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int ({{.*}})' +// C_INT-NEXT: |-FunctionDecl [[ADDR_8:0x[a-z0-9]*]] line:32:11 used also_before 'int (int)' // C_INT-NEXT: | |-ParmVarDecl [[ADDR_9:0x[a-z0-9]*]] col:27 i 'int' // C_INT-NEXT: | |-CompoundStmt [[ADDR_10:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_11:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_12:0x[a-z0-9]*]] 'int' 1 // C_INT-NEXT: | |-OverloadableAttr [[ADDR_13:0x[a-z0-9]*]] // C_INT-NEXT: | `-OMPDeclareVariantAttr [[ADDR_14:0x[a-z0-9]*]] <> Implicit implementation={extension(disable_implicit_base)} -// C_INT-NEXT: | `-DeclRefExpr [[ADDR_15:0x[a-z0-9]*]] 'int (int)' Function [[ADDR_16:0x[a-z0-9]*]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' -// C_INT-NEXT: |-FunctionDecl [[ADDR_7]] line:10:22 also_before[implementation={extension(disable_implicit_base)}] 'int ({{.*}})' -// C_INT-NEXT: | |-CompoundStmt [[ADDR_17:0x[a-z0-9]*]] +// C_INT-NEXT: | `-DeclRefExpr [[ADDR_15:0x[a-z0-9]*]] 'int (int)' Function [[ADDR_16:0x[a-z0-9]*]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' +// C_INT-NEXT: |-FunctionDecl [[ADDR_7]] line:38:1 also_before[implementation={extension(disable_implicit_base)}] 'int ({{.*}})' +// C_INT-NEXT: | |-CompoundStmt [[ADDR_17:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_18:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_19:0x[a-z0-9]*]] 'int' 0 // C_INT-NEXT: | `-OverloadableAttr [[ADDR_20:0x[a-z0-9]*]] -// C_INT-NEXT: |-FunctionDecl [[ADDR_16]] line:10:22 also_before[implementation={extension(disable_implicit_base)}] 'int (int)' -// C_INT-NEXT: | |-ParmVarDecl [[ADDR_21:0x[a-z0-9]*]] col:21 i 'int' +// C_INT-NEXT: |-FunctionDecl [[ADDR_16]] line:42:1 also_before[implementation={extension(disable_implicit_base)}] 'int (int)' +// C_INT-NEXT: | |-ParmVarDecl [[ADDR_21:0x[a-z0-9]*]] col:21 i 'int' // C_INT-NEXT: | |-CompoundStmt [[ADDR_22:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_23:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_24:0x[a-z0-9]*]] 'int' 0 // C_INT-NEXT: | `-OverloadableAttr [[ADDR_25:0x[a-z0-9]*]] -// C_INT-NEXT: |-FunctionDecl [[ADDR_26:0x[a-z0-9]*]] line:10:22 also_after[implementation={extension(disable_implicit_base)}] 'int (double)' -// C_INT-NEXT: | |-ParmVarDecl [[ADDR_27:0x[a-z0-9]*]] col:23 d 'double' +// C_INT-NEXT: |-FunctionDecl [[ADDR_26:0x[a-z0-9]*]] line:47:1 also_after[implementation={extension(disable_implicit_base)}] 'int (double)' +// C_INT-NEXT: | |-ParmVarDecl [[ADDR_27:0x[a-z0-9]*]] col:23 d 'double' // C_INT-NEXT: | |-CompoundStmt [[ADDR_28:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_29:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_30:0x[a-z0-9]*]] 'int' 1 // C_INT-NEXT: | `-OverloadableAttr [[ADDR_31:0x[a-z0-9]*]] -// C_INT-NEXT: |-FunctionDecl [[ADDR_32:0x[a-z0-9]*]] line:10:22 also_after[implementation={extension(disable_implicit_base)}] 'int (long)' -// C_INT-NEXT: | |-ParmVarDecl [[ADDR_33:0x[a-z0-9]*]] col:21 l 'long' +// C_INT-NEXT: |-FunctionDecl [[ADDR_32:0x[a-z0-9]*]] line:51:1 also_after[implementation={extension(disable_implicit_base)}] 'int (long)' +// C_INT-NEXT: | |-ParmVarDecl [[ADDR_33:0x[a-z0-9]*]] col:21 l 'long' // C_INT-NEXT: | |-CompoundStmt [[ADDR_34:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_35:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_36:0x[a-z0-9]*]] 'int' 1 // C_INT-NEXT: | `-OverloadableAttr [[ADDR_37:0x[a-z0-9]*]] -// C_INT-NEXT: |-FunctionDecl [[ADDR_38:0x[a-z0-9]*]] line:57:11 used also_after 'int (double)' +// C_INT-NEXT: |-FunctionDecl [[ADDR_38:0x[a-z0-9]*]] line:57:11 used also_after 'int (double)' // C_INT-NEXT: | |-ParmVarDecl [[ADDR_39:0x[a-z0-9]*]] col:29 d 'double' // C_INT-NEXT: | |-CompoundStmt [[ADDR_40:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_41:0x[a-z0-9]*]] // C_INT-NEXT: | | `-IntegerLiteral [[ADDR_42:0x[a-z0-9]*]] 'int' 0 // C_INT-NEXT: | `-OverloadableAttr [[ADDR_43:0x[a-z0-9]*]] -// C_INT-NEXT: |-FunctionDecl [[ADDR_44:0x[a-z0-9]*]] line:61:11 used also_after 'int (long)' +// C_INT-NEXT: |-FunctionDecl [[ADDR_44:0x[a-z0-9]*]] line:61:11 used also_after 'int (long)' // C_INT-NEXT: | |-ParmVarDecl [[ADDR_45:0x[a-z0-9]*]] col:27 l 'long' // C_INT-NEXT: | |-CompoundStmt [[ADDR_46:0x[a-z0-9]*]] // C_INT-NEXT: | | `-ReturnStmt [[ADDR_47:0x[a-z0-9]*]] @@ -283,17 +283,17 @@ // C_INT-NEXT: | | | | |-CallExpr [[ADDR_58:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | | | | `-ImplicitCastExpr [[ADDR_59:0x[a-z0-9]*]] 'int (*)({{.*}})' // C_INT-NEXT: | | | | | `-DeclRefExpr [[ADDR_60:0x[a-z0-9]*]] 'int ({{.*}})' {{.*}}Function [[ADDR_0]] 'also_before' 'int ({{.*}})' -// C_INT-NEXT: | | | | `-CallExpr [[ADDR_61:0x[a-z0-9]*]] 'int' -// C_INT-NEXT: | | | | `-ImplicitCastExpr [[ADDR_62:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C_INT-NEXT: | | | | `-DeclRefExpr [[ADDR_6]] 'int ({{.*}})' Function [[ADDR_7]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int ({{.*}})' +// C_INT-NEXT: | | | | `-CallExpr [[ADDR_61:0x[a-z0-9]*]] 'int' +// C_INT-NEXT: | | | | `-ImplicitCastExpr [[ADDR_62:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C_INT-NEXT: | | | | `-DeclRefExpr [[ADDR_6]] 'int ({{.*}})' Function [[ADDR_7]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int ({{.*}})' // C_INT-NEXT: | | | `-PseudoObjectExpr [[ADDR_63:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | | |-CallExpr [[ADDR_64:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | | | |-ImplicitCastExpr [[ADDR_65:0x[a-z0-9]*]] 'int (*)(int)' // C_INT-NEXT: | | | | | `-DeclRefExpr [[ADDR_66:0x[a-z0-9]*]] 'int (int)' {{.*}}Function [[ADDR_8]] 'also_before' 'int (int)' // C_INT-NEXT: | | | | `-IntegerLiteral [[ADDR_67:0x[a-z0-9]*]] 'int' 1 -// C_INT-NEXT: | | | `-CallExpr [[ADDR_68:0x[a-z0-9]*]] 'int' -// C_INT-NEXT: | | | |-ImplicitCastExpr [[ADDR_69:0x[a-z0-9]*]] 'int (*)(int)' -// C_INT-NEXT: | | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' +// C_INT-NEXT: | | | `-CallExpr [[ADDR_68:0x[a-z0-9]*]] 'int' +// C_INT-NEXT: | | | |-ImplicitCastExpr [[ADDR_69:0x[a-z0-9]*]] 'int (*)(int)' +// C_INT-NEXT: | | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' // C_INT-NEXT: | | | `-IntegerLiteral [[ADDR_67]] 'int' 1 // C_INT-NEXT: | | `-PseudoObjectExpr [[ADDR_70:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | |-CallExpr [[ADDR_71:0x[a-z0-9]*]] 'int' @@ -301,9 +301,9 @@ // C_INT-NEXT: | | | | `-DeclRefExpr [[ADDR_73:0x[a-z0-9]*]] 'int (int)' {{.*}}Function [[ADDR_8]] 'also_before' 'int (int)' // C_INT-NEXT: | | | `-ImplicitCastExpr [[ADDR_74:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | | `-FloatingLiteral [[ADDR_75:0x[a-z0-9]*]] 'float' 2.000000e+00 -// C_INT-NEXT: | | `-CallExpr [[ADDR_76:0x[a-z0-9]*]] 'int' -// C_INT-NEXT: | | |-ImplicitCastExpr [[ADDR_77:0x[a-z0-9]*]] 'int (*)(int)' -// C_INT-NEXT: | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' +// C_INT-NEXT: | | `-CallExpr [[ADDR_76:0x[a-z0-9]*]] 'int' +// C_INT-NEXT: | | |-ImplicitCastExpr [[ADDR_77:0x[a-z0-9]*]] 'int (*)(int)' +// C_INT-NEXT: | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={extension(disable_implicit_base)}]' 'int (int)' // C_INT-NEXT: | | `-ImplicitCastExpr [[ADDR_78:0x[a-z0-9]*]] 'int' // C_INT-NEXT: | | `-FloatingLiteral [[ADDR_75]] 'float' 2.000000e+00 // C_INT-NEXT: | `-CallExpr [[ADDR_79:0x[a-z0-9]*]] 'int' diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c b/clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_10.c @@ -51,7 +51,7 @@ // C-NEXT: | | `-ReturnStmt [[ADDR_2:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_3:0x[a-z0-9]*]] 'int' 1 // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_4:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_5:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_6:0x[a-z0-9]*]] 'also_before1[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_5:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_6:0x[a-z0-9]*]] 'also_before1[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: |-FunctionDecl [[ADDR_7:0x[a-z0-9]*]] line:14:5 used also_before2 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_8:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_9:0x[a-z0-9]*]] @@ -63,15 +63,15 @@ // C-NEXT: | | `-ReturnStmt [[ADDR_16:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_17:0x[a-z0-9]*]] 'int' 3 // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_18:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_20:0x[a-z0-9]*]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_20:0x[a-z0-9]*]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: |-FunctionDecl [[ADDR_21:0x[a-z0-9]*]] line:20:5 used also_before4 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_22:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_23:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_24:0x[a-z0-9]*]] 'int' 4 // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_25:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} // C-NEXT: | `-DeclRefExpr [[ADDR_26:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_27:0x[a-z0-9]*]] 'also_before4[implementation={vendor(llvm)}]' 'int ({{.*}})' -// C-NEXT: |-FunctionDecl [[ADDR_6]] line:8:15 also_before1[implementation={vendor(llvm)}] 'int ({{.*}})' -// C-NEXT: | |-CompoundStmt [[ADDR_28:0x[a-z0-9]*]] +// C-NEXT: |-FunctionDecl [[ADDR_6]] line:25:7 also_before1[implementation={vendor(llvm)}] 'int ({{.*}})' +// C-NEXT: | |-CompoundStmt [[ADDR_28:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_29:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_30:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-ConstAttr [[ADDR_31:0x[a-z0-9]*]] @@ -79,7 +79,7 @@ // C-NEXT: | `-CompoundStmt [[ADDR_32:0x[a-z0-9]*]] // C-NEXT: | `-ReturnStmt [[ADDR_33:0x[a-z0-9]*]] // C-NEXT: | `-IntegerLiteral [[ADDR_34:0x[a-z0-9]*]] 'int' 0 -// C-NEXT: |-FunctionDecl [[ADDR_20]] line:31:1 also_before3[implementation={vendor(llvm)}] 'int ({{.*}})' +// C-NEXT: |-FunctionDecl [[ADDR_20]] line:31:26 also_before3[implementation={vendor(llvm)}] 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_35:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_36:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_37:0x[a-z0-9]*]] 'int' 0 @@ -101,9 +101,9 @@ // C-NEXT: | | | |-CallExpr [[ADDR_52:0x[a-z0-9]*]] 'int' // C-NEXT: | | | | `-ImplicitCastExpr [[ADDR_53:0x[a-z0-9]*]] 'int (*)({{.*}})' // C-NEXT: | | | | `-DeclRefExpr [[ADDR_54:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_0]] 'also_before1' 'int ({{.*}})' -// C-NEXT: | | | `-CallExpr [[ADDR_55:0x[a-z0-9]*]] 'int' -// C-NEXT: | | | `-ImplicitCastExpr [[ADDR_56:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C-NEXT: | | | `-DeclRefExpr [[ADDR_5]] 'int ({{.*}})' Function [[ADDR_6]] 'also_before1[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | | | `-CallExpr [[ADDR_55:0x[a-z0-9]*]] 'int' +// C-NEXT: | | | `-ImplicitCastExpr [[ADDR_56:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C-NEXT: | | | `-DeclRefExpr [[ADDR_5]] 'int ({{.*}})' Function [[ADDR_6]] 'also_before1[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: | | `-PseudoObjectExpr [[ADDR_57:0x[a-z0-9]*]] 'int' // C-NEXT: | | |-CallExpr [[ADDR_58:0x[a-z0-9]*]] 'int' // C-NEXT: | | | `-ImplicitCastExpr [[ADDR_59:0x[a-z0-9]*]] 'int (*)({{.*}})' @@ -115,9 +115,9 @@ // C-NEXT: | |-CallExpr [[ADDR_64:0x[a-z0-9]*]] 'int' // C-NEXT: | | `-ImplicitCastExpr [[ADDR_65:0x[a-z0-9]*]] 'int (*)({{.*}})' // C-NEXT: | | `-DeclRefExpr [[ADDR_66:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_14]] 'also_before3' 'int ({{.*}})' -// C-NEXT: | `-CallExpr [[ADDR_67:0x[a-z0-9]*]] 'int' -// C-NEXT: | `-ImplicitCastExpr [[ADDR_68:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-CallExpr [[ADDR_67:0x[a-z0-9]*]] 'int' +// C-NEXT: | `-ImplicitCastExpr [[ADDR_68:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: `-PseudoObjectExpr [[ADDR_69:0x[a-z0-9]*]] 'int' // C-NEXT: |-CallExpr [[ADDR_70:0x[a-z0-9]*]] 'int' // C-NEXT: | `-ImplicitCastExpr [[ADDR_71:0x[a-z0-9]*]] 'int (*)({{.*}})' @@ -143,7 +143,7 @@ // CXX-NEXT: | | `-ReturnStmt [[ADDR_16:0x[a-z0-9]*]] // CXX-NEXT: | | `-IntegerLiteral [[ADDR_17:0x[a-z0-9]*]] 'int' 3 // CXX-NEXT: | `-OMPDeclareVariantAttr [[ADDR_18:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// CXX-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_20:0x[a-z0-9]*]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_20:0x[a-z0-9]*]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: |-FunctionDecl [[ADDR_21:0x[a-z0-9]*]] line:20:5 used also_before4 'int ({{.*}})' // CXX-NEXT: | |-CompoundStmt [[ADDR_22:0x[a-z0-9]*]] // CXX-NEXT: | | `-ReturnStmt [[ADDR_23:0x[a-z0-9]*]] @@ -158,7 +158,7 @@ // CXX-NEXT: | `-CompoundStmt [[ADDR_31:0x[a-z0-9]*]] // CXX-NEXT: | `-ReturnStmt [[ADDR_32:0x[a-z0-9]*]] // CXX-NEXT: | `-IntegerLiteral [[ADDR_33:0x[a-z0-9]*]] 'int' 0 -// CXX-NEXT: |-FunctionDecl [[ADDR_20]] line:31:1 also_before3[implementation={vendor(llvm)}] 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: |-FunctionDecl [[ADDR_20]] line:31:26 also_before3[implementation={vendor(llvm)}] 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: | `-CompoundStmt [[ADDR_34:0x[a-z0-9]*]] // CXX-NEXT: | `-ReturnStmt [[ADDR_35:0x[a-z0-9]*]] // CXX-NEXT: | `-IntegerLiteral [[ADDR_36:0x[a-z0-9]*]] 'int' 0 @@ -191,9 +191,9 @@ // CXX-NEXT: | |-CallExpr [[ADDR_60:0x[a-z0-9]*]] 'int' // CXX-NEXT: | | `-ImplicitCastExpr [[ADDR_61:0x[a-z0-9]*]] 'int (*)({{.*}})' // CXX-NEXT: | | `-DeclRefExpr [[ADDR_62:0x[a-z0-9]*]] 'int ({{.*}})' {{.*}}Function [[ADDR_14]] 'also_before3' 'int ({{.*}})' -// CXX-NEXT: | `-CallExpr [[ADDR_63:0x[a-z0-9]*]] 'int' -// CXX-NEXT: | `-ImplicitCastExpr [[ADDR_64:0x[a-z0-9]*]] 'int (*)({{.*}}) __attribute__((nothrow))' -// CXX-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_20]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-CallExpr [[ADDR_63:0x[a-z0-9]*]] 'int' +// CXX-NEXT: | `-ImplicitCastExpr [[ADDR_64:0x[a-z0-9]*]] 'int (*)({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_20]] 'also_before3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: `-PseudoObjectExpr [[ADDR_65:0x[a-z0-9]*]] 'int' // CXX-NEXT: |-CallExpr [[ADDR_66:0x[a-z0-9]*]] 'int' // CXX-NEXT: | `-ImplicitCastExpr [[ADDR_67:0x[a-z0-9]*]] 'int (*)({{.*}})' diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c b/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_11.c @@ -47,12 +47,12 @@ // - we see the specialization in the AST // - we pick the right callees -// C: |-FunctionDecl [[ADDR_0:0x[a-z0-9]*]] <{{.*}}, line:13:27> col:11 implicit used also_after1 'int ({{.*}})' +// C: |-FunctionDecl [[ADDR_0:0x[a-z0-9]*]] <{{.*}}:13:7, col:27> col:11 implicit used also_after1 'int ({{.*}})' // C-NEXT: | |-ConstAttr [[ADDR_1:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_2:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_3:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_4:0x[a-z0-9]*]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' -// C-NEXT: |-FunctionDecl [[ADDR_4]] line:9:15 also_after1[implementation={vendor(llvm)}] 'int ({{.*}})' -// C-NEXT: | |-CompoundStmt [[ADDR_5:0x[a-z0-9]*]] +// C-NEXT: | `-DeclRefExpr [[ADDR_3:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_4:0x[a-z0-9]*]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: |-FunctionDecl [[ADDR_4]] line:13:7 also_after1[implementation={vendor(llvm)}] 'int ({{.*}})' +// C-NEXT: | |-CompoundStmt [[ADDR_5:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_6:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_7:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-ConstAttr [[ADDR_8:0x[a-z0-9]*]] @@ -63,11 +63,11 @@ // C-NEXT: | `-CompoundStmt [[ADDR_13:0x[a-z0-9]*]] // C-NEXT: | `-ReturnStmt [[ADDR_14:0x[a-z0-9]*]] // C-NEXT: | `-IntegerLiteral [[ADDR_15:0x[a-z0-9]*]] 'int' 0 -// C-NEXT: |-FunctionDecl [[ADDR_16:0x[a-z0-9]*]] col:30 implicit used also_after3 'int ({{.*}})' +// C-NEXT: |-FunctionDecl [[ADDR_16:0x[a-z0-9]*]] col:30 implicit used also_after3 'int ({{.*}})' // C-NEXT: | |-NoThrowAttr [[ADDR_17:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_18:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_20:0x[a-z0-9]*]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' -// C-NEXT: |-FunctionDecl [[ADDR_20]] line:19:1 also_after3[implementation={vendor(llvm)}] 'int ({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_19:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_20:0x[a-z0-9]*]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: |-FunctionDecl [[ADDR_20]] line:19:26 also_after3[implementation={vendor(llvm)}] 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_21:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_22:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_23:0x[a-z0-9]*]] 'int' 0 @@ -91,7 +91,7 @@ // C-NEXT: | | `-IntegerLiteral [[ADDR_41:0x[a-z0-9]*]] 'int' 1 // C-NEXT: | |-ConstAttr [[ADDR_42:0x[a-z0-9]*]] Inherited // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_43:0x[a-z0-9]*]] <> Inherited Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_3]] 'int ({{.*}})' Function [[ADDR_4]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_3]] 'int ({{.*}})' Function [[ADDR_4]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: |-FunctionDecl [[ADDR_44:0x[a-z0-9]*]] prev [[ADDR_9]] line:30:5 used also_after2 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_45:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_46:0x[a-z0-9]*]] @@ -104,7 +104,7 @@ // C-NEXT: | | `-IntegerLiteral [[ADDR_52:0x[a-z0-9]*]] 'int' 3 // C-NEXT: | |-NoThrowAttr [[ADDR_53:0x[a-z0-9]*]] Inherited // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_54:0x[a-z0-9]*]] <> Inherited Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: |-FunctionDecl [[ADDR_55:0x[a-z0-9]*]] prev [[ADDR_25]] line:36:5 used also_after4 'int ({{.*}})' // C-NEXT: | |-CompoundStmt [[ADDR_56:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_57:0x[a-z0-9]*]] @@ -124,9 +124,9 @@ // C-NEXT: | | | |-CallExpr [[ADDR_70:0x[a-z0-9]*]] 'int' // C-NEXT: | | | | `-ImplicitCastExpr [[ADDR_71:0x[a-z0-9]*]] 'int (*)({{.*}})' // C-NEXT: | | | | `-DeclRefExpr [[ADDR_72:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_38]] 'also_after1' 'int ({{.*}})' -// C-NEXT: | | | `-CallExpr [[ADDR_73:0x[a-z0-9]*]] 'int' -// C-NEXT: | | | `-ImplicitCastExpr [[ADDR_74:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C-NEXT: | | | `-DeclRefExpr [[ADDR_3]] 'int ({{.*}})' Function [[ADDR_4]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | | | `-CallExpr [[ADDR_73:0x[a-z0-9]*]] 'int' +// C-NEXT: | | | `-ImplicitCastExpr [[ADDR_74:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C-NEXT: | | | `-DeclRefExpr [[ADDR_3]] 'int ({{.*}})' Function [[ADDR_4]] 'also_after1[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: | | `-PseudoObjectExpr [[ADDR_75:0x[a-z0-9]*]] 'int' // C-NEXT: | | |-CallExpr [[ADDR_76:0x[a-z0-9]*]] 'int' // C-NEXT: | | | `-ImplicitCastExpr [[ADDR_77:0x[a-z0-9]*]] 'int (*)({{.*}})' @@ -138,9 +138,9 @@ // C-NEXT: | |-CallExpr [[ADDR_82:0x[a-z0-9]*]] 'int' // C-NEXT: | | `-ImplicitCastExpr [[ADDR_83:0x[a-z0-9]*]] 'int (*)({{.*}})' // C-NEXT: | | `-DeclRefExpr [[ADDR_84:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_49]] 'also_after3' 'int ({{.*}})' -// C-NEXT: | `-CallExpr [[ADDR_85:0x[a-z0-9]*]] 'int' -// C-NEXT: | `-ImplicitCastExpr [[ADDR_86:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | `-CallExpr [[ADDR_85:0x[a-z0-9]*]] 'int' +// C-NEXT: | `-ImplicitCastExpr [[ADDR_86:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C-NEXT: | `-DeclRefExpr [[ADDR_19]] 'int ({{.*}})' Function [[ADDR_20]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: `-PseudoObjectExpr [[ADDR_87:0x[a-z0-9]*]] 'int' // C-NEXT: |-CallExpr [[ADDR_88:0x[a-z0-9]*]] 'int' // C-NEXT: | `-ImplicitCastExpr [[ADDR_89:0x[a-z0-9]*]] 'int (*)({{.*}})' @@ -163,10 +163,10 @@ // CXX-NEXT: | `-CompoundStmt [[ADDR_11:0x[a-z0-9]*]] // CXX-NEXT: | `-ReturnStmt [[ADDR_12:0x[a-z0-9]*]] // CXX-NEXT: | `-IntegerLiteral [[ADDR_13:0x[a-z0-9]*]] 'int' 0 -// CXX-NEXT: |-FunctionDecl [[ADDR_14:0x[a-z0-9]*]] col:30 implicit used also_after3 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: |-FunctionDecl [[ADDR_14:0x[a-z0-9]*]] col:30 implicit used also_after3 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: | `-OMPDeclareVariantAttr [[ADDR_15:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// CXX-NEXT: | `-DeclRefExpr [[ADDR_16:0x[a-z0-9]*]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17:0x[a-z0-9]*]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' -// CXX-NEXT: |-FunctionDecl [[ADDR_17]] line:19:1 also_after3[implementation={vendor(llvm)}] 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-DeclRefExpr [[ADDR_16:0x[a-z0-9]*]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17:0x[a-z0-9]*]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: |-FunctionDecl [[ADDR_17]] line:19:26 also_after3[implementation={vendor(llvm)}] 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: | `-CompoundStmt [[ADDR_18:0x[a-z0-9]*]] // CXX-NEXT: | `-ReturnStmt [[ADDR_19:0x[a-z0-9]*]] // CXX-NEXT: | `-IntegerLiteral [[ADDR_20:0x[a-z0-9]*]] 'int' 0 @@ -196,7 +196,7 @@ // CXX-NEXT: | | `-ReturnStmt [[ADDR_42:0x[a-z0-9]*]] // CXX-NEXT: | | `-IntegerLiteral [[ADDR_43:0x[a-z0-9]*]] 'int' 3 // CXX-NEXT: | `-OMPDeclareVariantAttr [[ADDR_44:0x[a-z0-9]*]] <> Inherited Implicit implementation={vendor(llvm)} -// CXX-NEXT: | `-DeclRefExpr [[ADDR_16]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-DeclRefExpr [[ADDR_16]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: |-FunctionDecl [[ADDR_45:0x[a-z0-9]*]] line:36:5 invalid also_after4 'int ({{.*}})' // CXX-NEXT: | |-CompoundStmt [[ADDR_46:0x[a-z0-9]*]] // CXX-NEXT: | | `-ReturnStmt [[ADDR_47:0x[a-z0-9]*]] @@ -228,9 +228,9 @@ // CXX-NEXT: | |-CallExpr [[ADDR_70:0x[a-z0-9]*]] 'int' // CXX-NEXT: | | `-ImplicitCastExpr [[ADDR_71:0x[a-z0-9]*]] 'int (*)({{.*}})' // CXX-NEXT: | | `-DeclRefExpr [[ADDR_72:0x[a-z0-9]*]] 'int ({{.*}})' {{.*}}Function [[ADDR_40]] 'also_after3' 'int ({{.*}})' -// CXX-NEXT: | `-CallExpr [[ADDR_73:0x[a-z0-9]*]] 'int' -// CXX-NEXT: | `-ImplicitCastExpr [[ADDR_74:0x[a-z0-9]*]] 'int (*)({{.*}}) __attribute__((nothrow))' -// CXX-NEXT: | `-DeclRefExpr [[ADDR_16]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-CallExpr [[ADDR_73:0x[a-z0-9]*]] 'int' +// CXX-NEXT: | `-ImplicitCastExpr [[ADDR_74:0x[a-z0-9]*]] 'int (*)({{.*}}) __attribute__((nothrow))' +// CXX-NEXT: | `-DeclRefExpr [[ADDR_16]] 'int ({{.*}}) __attribute__((nothrow))' Function [[ADDR_17]] 'also_after3[implementation={vendor(llvm)}]' 'int ({{.*}}) __attribute__((nothrow))' // CXX-NEXT: `-PseudoObjectExpr [[ADDR_75:0x[a-z0-9]*]] 'int' // CXX-NEXT: |-CallExpr [[ADDR_76:0x[a-z0-9]*]] 'int' // CXX-NEXT: | `-ImplicitCastExpr [[ADDR_77:0x[a-z0-9]*]] 'int (*)({{.*}}) __attribute__((nothrow))' diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c b/clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c --- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c +++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_12.c @@ -65,56 +65,56 @@ // C-NEXT: | | `-IntegerLiteral [[ADDR_3:0x[a-z0-9]*]] 'int' 1 // C-NEXT: | |-OverloadableAttr [[ADDR_4:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_5:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_6:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_7:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int ({{.*}})' -// C-NEXT: |-FunctionDecl [[ADDR_8:0x[a-z0-9]*]] line:16:5 used also_before 'int (int)' +// C-NEXT: | `-DeclRefExpr [[ADDR_6:0x[a-z0-9]*]] 'int ({{.*}})' Function [[ADDR_7:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: |-FunctionDecl [[ADDR_8:0x[a-z0-9]*]] line:16:5 used also_before 'int (int)' // C-NEXT: | |-ParmVarDecl [[ADDR_9:0x[a-z0-9]*]] col:21 i 'int' // C-NEXT: | |-CompoundStmt [[ADDR_10:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_11:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_12:0x[a-z0-9]*]] 'int' 2 // C-NEXT: | |-OverloadableAttr [[ADDR_13:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_14:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_15:0x[a-z0-9]*]] 'int (int)' Function [[ADDR_16:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (int)' -// C-NEXT: |-FunctionDecl [[ADDR_17:0x[a-z0-9]*]] line:20:5 used also_before 'int (float)' +// C-NEXT: | `-DeclRefExpr [[ADDR_15:0x[a-z0-9]*]] 'int (int)' Function [[ADDR_16:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (int)' +// C-NEXT: |-FunctionDecl [[ADDR_17:0x[a-z0-9]*]] line:20:5 used also_before 'int (float)' // C-NEXT: | |-ParmVarDecl [[ADDR_18:0x[a-z0-9]*]] col:23 f 'float' // C-NEXT: | |-CompoundStmt [[ADDR_19:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_20:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_21:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-OverloadableAttr [[ADDR_22:0x[a-z0-9]*]] -// C-NEXT: |-FunctionDecl [[ADDR_23:0x[a-z0-9]*]] line:24:5 used also_before 'int (double)' +// C-NEXT: |-FunctionDecl [[ADDR_23:0x[a-z0-9]*]] line:24:5 used also_before 'int (double)' // C-NEXT: | |-ParmVarDecl [[ADDR_24:0x[a-z0-9]*]] col:24 d 'double' // C-NEXT: | |-CompoundStmt [[ADDR_25:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_26:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_27:0x[a-z0-9]*]] 'int' 3 // C-NEXT: | |-OverloadableAttr [[ADDR_28:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_29:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_30:0x[a-z0-9]*]] 'int (double)' Function [[ADDR_31:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (double)' -// C-NEXT: |-FunctionDecl [[ADDR_32:0x[a-z0-9]*]] line:28:5 used also_before 'int (long)' +// C-NEXT: | `-DeclRefExpr [[ADDR_30:0x[a-z0-9]*]] 'int (double)' Function [[ADDR_31:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (double)' +// C-NEXT: |-FunctionDecl [[ADDR_32:0x[a-z0-9]*]] line:28:5 used also_before 'int (long)' // C-NEXT: | |-ParmVarDecl [[ADDR_33:0x[a-z0-9]*]] col:22 l 'long' // C-NEXT: | |-CompoundStmt [[ADDR_34:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_35:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_36:0x[a-z0-9]*]] 'int' 4 // C-NEXT: | |-OverloadableAttr [[ADDR_37:0x[a-z0-9]*]] // C-NEXT: | `-OMPDeclareVariantAttr [[ADDR_38:0x[a-z0-9]*]] <> Implicit implementation={vendor(llvm)} -// C-NEXT: | `-DeclRefExpr [[ADDR_39:0x[a-z0-9]*]] 'int (long)' Function [[ADDR_40:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (long)' -// C-NEXT: |-FunctionDecl [[ADDR_7]] line:8:22 also_before[implementation={vendor(llvm)}] 'int ({{.*}})' -// C-NEXT: | |-CompoundStmt [[ADDR_41:0x[a-z0-9]*]] +// C-NEXT: | `-DeclRefExpr [[ADDR_39:0x[a-z0-9]*]] 'int (long)' Function [[ADDR_40:0x[a-z0-9]*]] 'also_before[implementation={vendor(llvm)}]' 'int (long)' +// C-NEXT: |-FunctionDecl [[ADDR_7]] line:34:1 also_before[implementation={vendor(llvm)}] 'int ({{.*}})' +// C-NEXT: | |-CompoundStmt [[ADDR_41:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_42:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_43:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-OverloadableAttr [[ADDR_44:0x[a-z0-9]*]] -// C-NEXT: |-FunctionDecl [[ADDR_16]] line:8:22 also_before[implementation={vendor(llvm)}] 'int (int)' -// C-NEXT: | |-ParmVarDecl [[ADDR_45:0x[a-z0-9]*]] col:21 i 'int' +// C-NEXT: |-FunctionDecl [[ADDR_16]] line:38:1 also_before[implementation={vendor(llvm)}] 'int (int)' +// C-NEXT: | |-ParmVarDecl [[ADDR_45:0x[a-z0-9]*]] col:21 i 'int' // C-NEXT: | |-CompoundStmt [[ADDR_46:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_47:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_48:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-OverloadableAttr [[ADDR_49:0x[a-z0-9]*]] -// C-NEXT: |-FunctionDecl [[ADDR_31]] line:8:22 also_before[implementation={vendor(llvm)}] 'int (double)' -// C-NEXT: | |-ParmVarDecl [[ADDR_50:0x[a-z0-9]*]] col:24 d 'double' +// C-NEXT: |-FunctionDecl [[ADDR_31]] line:43:1 also_before[implementation={vendor(llvm)}] 'int (double)' +// C-NEXT: | |-ParmVarDecl [[ADDR_50:0x[a-z0-9]*]] col:24 d 'double' // C-NEXT: | |-CompoundStmt [[ADDR_51:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_52:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_53:0x[a-z0-9]*]] 'int' 0 // C-NEXT: | `-OverloadableAttr [[ADDR_54:0x[a-z0-9]*]] -// C-NEXT: |-FunctionDecl [[ADDR_40]] line:8:22 also_before[implementation={vendor(llvm)}] 'int (long)' -// C-NEXT: | |-ParmVarDecl [[ADDR_55:0x[a-z0-9]*]] col:22 l 'long' +// C-NEXT: |-FunctionDecl [[ADDR_40]] line:47:1 also_before[implementation={vendor(llvm)}] 'int (long)' +// C-NEXT: | |-ParmVarDecl [[ADDR_55:0x[a-z0-9]*]] col:22 l 'long' // C-NEXT: | |-CompoundStmt [[ADDR_56:0x[a-z0-9]*]] // C-NEXT: | | `-ReturnStmt [[ADDR_57:0x[a-z0-9]*]] // C-NEXT: | | `-IntegerLiteral [[ADDR_58:0x[a-z0-9]*]] 'int' 0 @@ -130,17 +130,17 @@ // C-NEXT: | | | | |-CallExpr [[ADDR_68:0x[a-z0-9]*]] 'int' // C-NEXT: | | | | | `-ImplicitCastExpr [[ADDR_69:0x[a-z0-9]*]] 'int (*)({{.*}})' // C-NEXT: | | | | | `-DeclRefExpr [[ADDR_70:0x[a-z0-9]*]] 'int ({{.*}})' {{.*}}Function [[ADDR_0]] 'also_before' 'int ({{.*}})' -// C-NEXT: | | | | `-CallExpr [[ADDR_71:0x[a-z0-9]*]] 'int' -// C-NEXT: | | | | `-ImplicitCastExpr [[ADDR_72:0x[a-z0-9]*]] 'int (*)({{.*}})' -// C-NEXT: | | | | `-DeclRefExpr [[ADDR_6]] 'int ({{.*}})' Function [[ADDR_7]] 'also_before[implementation={vendor(llvm)}]' 'int ({{.*}})' +// C-NEXT: | | | | `-CallExpr [[ADDR_71:0x[a-z0-9]*]] 'int' +// C-NEXT: | | | | `-ImplicitCastExpr [[ADDR_72:0x[a-z0-9]*]] 'int (*)({{.*}})' +// C-NEXT: | | | | `-DeclRefExpr [[ADDR_6]] 'int ({{.*}})' Function [[ADDR_7]] 'also_before[implementation={vendor(llvm)}]' 'int ({{.*}})' // C-NEXT: | | | `-PseudoObjectExpr [[ADDR_73:0x[a-z0-9]*]] 'int' // C-NEXT: | | | |-CallExpr [[ADDR_74:0x[a-z0-9]*]] 'int' // C-NEXT: | | | | |-ImplicitCastExpr [[ADDR_75:0x[a-z0-9]*]] 'int (*)(int)' // C-NEXT: | | | | | `-DeclRefExpr [[ADDR_76:0x[a-z0-9]*]] 'int (int)' {{.*}}Function [[ADDR_8]] 'also_before' 'int (int)' // C-NEXT: | | | | `-IntegerLiteral [[ADDR_77:0x[a-z0-9]*]] 'int' 1 -// C-NEXT: | | | `-CallExpr [[ADDR_78:0x[a-z0-9]*]] 'int' -// C-NEXT: | | | |-ImplicitCastExpr [[ADDR_79:0x[a-z0-9]*]] 'int (*)(int)' -// C-NEXT: | | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={vendor(llvm)}]' 'int (int)' +// C-NEXT: | | | `-CallExpr [[ADDR_78:0x[a-z0-9]*]] 'int' +// C-NEXT: | | | |-ImplicitCastExpr [[ADDR_79:0x[a-z0-9]*]] 'int (*)(int)' +// C-NEXT: | | | | `-DeclRefExpr [[ADDR_15]] 'int (int)' Function [[ADDR_16]] 'also_before[implementation={vendor(llvm)}]' 'int (int)' // C-NEXT: | | | `-IntegerLiteral [[ADDR_77]] 'int' 1 // C-NEXT: | | `-CallExpr [[ADDR_80:0x[a-z0-9]*]] 'int' // C-NEXT: | | |-ImplicitCastExpr [[ADDR_81:0x[a-z0-9]*]] 'int (*)(float)' @@ -151,18 +151,18 @@ // C-NEXT: | | |-ImplicitCastExpr [[ADDR_86:0x[a-z0-9]*]] 'int (*)(double)' // C-NEXT: | | | `-DeclRefExpr [[ADDR_87:0x[a-z0-9]*]] 'int (double)' {{.*}}Function [[ADDR_23]] 'also_before' 'int (double)' // C-NEXT: | | `-FloatingLiteral [[ADDR_88:0x[a-z0-9]*]] 'double' 3.000000e+00 -// C-NEXT: | `-CallExpr [[ADDR_89:0x[a-z0-9]*]] 'int' -// C-NEXT: | |-ImplicitCastExpr [[ADDR_90:0x[a-z0-9]*]] 'int (*)(double)' -// C-NEXT: | | `-DeclRefExpr [[ADDR_30]] 'int (double)' Function [[ADDR_31]] 'also_before[implementation={vendor(llvm)}]' 'int (double)' +// C-NEXT: | `-CallExpr [[ADDR_89:0x[a-z0-9]*]] 'int' +// C-NEXT: | |-ImplicitCastExpr [[ADDR_90:0x[a-z0-9]*]] 'int (*)(double)' +// C-NEXT: | | `-DeclRefExpr [[ADDR_30]] 'int (double)' Function [[ADDR_31]] 'also_before[implementation={vendor(llvm)}]' 'int (double)' // C-NEXT: | `-FloatingLiteral [[ADDR_88]] 'double' 3.000000e+00 // C-NEXT: `-PseudoObjectExpr [[ADDR_91:0x[a-z0-9]*]] 'int' // C-NEXT: |-CallExpr [[ADDR_92:0x[a-z0-9]*]] 'int' // C-NEXT: | |-ImplicitCastExpr [[ADDR_93:0x[a-z0-9]*]] 'int (*)(long)' // C-NEXT: | | `-DeclRefExpr [[ADDR_94:0x[a-z0-9]*]] 'int (long)' {{.*}}Function [[ADDR_32]] 'also_before' 'int (long)' // C-NEXT: | `-IntegerLiteral [[ADDR_95:0x[a-z0-9]*]] 'long' 4 -// C-NEXT: `-CallExpr [[ADDR_96:0x[a-z0-9]*]] 'int' -// C-NEXT: |-ImplicitCastExpr [[ADDR_97:0x[a-z0-9]*]] 'int (*)(long)' -// C-NEXT: | `-DeclRefExpr [[ADDR_39]] 'int (long)' Function [[ADDR_40]] 'also_before[implementation={vendor(llvm)}]' 'int (long)' +// C-NEXT: `-CallExpr [[ADDR_96:0x[a-z0-9]*]] 'int' +// C-NEXT: |-ImplicitCastExpr [[ADDR_97:0x[a-z0-9]*]] 'int (*)(long)' +// C-NEXT: | `-DeclRefExpr [[ADDR_39]] 'int (long)' Function [[ADDR_40]] 'also_before[implementation={vendor(llvm)}]' 'int (long)' // C-NEXT: `-IntegerLiteral [[ADDR_95]] 'long' 4 // CXX: |-FunctionDecl [[ADDR_0:0x[a-z0-9]*]] <{{.*}}, line:14:1> line:12:5 used also_before 'int ({{.*}})' diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist --- a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist @@ -17872,7 +17872,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -17890,13 +17890,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18195,7 +18195,6 @@ 0 - 1633 1634 1635 1643 @@ -18275,7 +18274,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -18293,13 +18292,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18460,7 +18459,6 @@ 0 - 1633 1634 1635 1655 @@ -18538,7 +18536,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -18556,13 +18554,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18723,7 +18721,6 @@ 0 - 1633 1634 1635 1659 diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist --- a/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist @@ -17941,7 +17941,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -17959,13 +17959,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18264,7 +18264,6 @@ 0 - 1633 1634 1635 1643 @@ -18344,7 +18343,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -18362,13 +18361,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18529,7 +18528,6 @@ 0 - 1633 1634 1635 1655 @@ -18607,7 +18605,7 @@ kindevent location - line1633 + line1634 col1 file0 @@ -18625,13 +18623,13 @@ start - line1633 + line1634 col1 file0 - line1633 - col19 + line1634 + col9 file0 @@ -18792,7 +18790,6 @@ 0 - 1633 1634 1635 1659 diff --git a/clang/test/Parser/attr-order.cpp b/clang/test/Parser/attr-order.cpp --- a/clang/test/Parser/attr-order.cpp +++ b/clang/test/Parser/attr-order.cpp @@ -17,8 +17,8 @@ __declspec(dllexport) [[noreturn]] __attribute__((cdecl)) void d(); // expected-error {{an attribute list cannot appear here}} __declspec(dllexport) __attribute__((cdecl)) [[noreturn]] void e(); // expected-error {{an attribute list cannot appear here}} __attribute__((cdecl)) __declspec(dllexport) [[noreturn]] void f(); // expected-error {{an attribute list cannot appear here}} -__attribute__((cdecl)) [[noreturn]] __declspec(dllexport) void g(); // expected-error {{an attribute list cannot appear here}} +__attribute__((cdecl)) [[noreturn]] __declspec(dllexport) void g(); [[noreturn]] __attribute__((cdecl)) -[[]] // expected-error {{an attribute list cannot appear here}} +[[]] __declspec(dllexport) void h(); diff --git a/clang/test/Parser/cxx-attributes.cpp b/clang/test/Parser/cxx-attributes.cpp --- a/clang/test/Parser/cxx-attributes.cpp +++ b/clang/test/Parser/cxx-attributes.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// GH#58229 - rejects-valid +__attribute__((__visibility__("default"))) [[nodiscard]] int f(); +[[nodiscard]] __attribute__((__visibility__("default"))) int f(); + class c { virtual void f1(const char* a, ...) __attribute__ (( __format__(__printf__,2,3) )) = 0; diff --git a/clang/test/SemaCXX/attr-unavailable.cpp b/clang/test/SemaCXX/attr-unavailable.cpp --- a/clang/test/SemaCXX/attr-unavailable.cpp +++ b/clang/test/SemaCXX/attr-unavailable.cpp @@ -42,18 +42,18 @@ // delayed process for 'deprecated'. // and enum DeprecatedEnum { DE_A, DE_B } __attribute__((deprecated)); // expected-note {{'DeprecatedEnum' has been explicitly marked deprecated here}} -__attribute__((deprecated)) typedef enum DeprecatedEnum DeprecatedEnum; typedef enum DeprecatedEnum AnotherDeprecatedEnum; // expected-warning {{'DeprecatedEnum' is deprecated}} +__attribute__((deprecated)) typedef enum DeprecatedEnum DeprecatedEnum; __attribute__((deprecated)) DeprecatedEnum testDeprecated(DeprecatedEnum X) { return X; } enum UnavailableEnum { UE_A, UE_B } __attribute__((unavailable)); // expected-note {{'UnavailableEnum' has been explicitly marked unavailable here}} -__attribute__((unavailable)) typedef enum UnavailableEnum UnavailableEnum; typedef enum UnavailableEnum AnotherUnavailableEnum; // expected-error {{'UnavailableEnum' is unavailable}} + // - +__attribute__((unavailable)) typedef enum UnavailableEnum UnavailableEnum; __attribute__((unavailable)) UnavailableEnum testUnavailable(UnavailableEnum X) { return X; } diff --git a/clang/test/SemaObjC/objc-asm-attribute-neg-test.m b/clang/test/SemaObjC/objc-asm-attribute-neg-test.m --- a/clang/test/SemaObjC/objc-asm-attribute-neg-test.m +++ b/clang/test/SemaObjC/objc-asm-attribute-neg-test.m @@ -28,7 +28,7 @@ @end __attribute__((objc_runtime_name("MySecretNamespace.ForwardClass"))) -@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}} +@class ForwardClass; // expected-error@-1 {{prefix attribute must be followed by an interface, protocol, or implementation}} __attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol"))) @protocol ForwardProtocol; diff --git a/clang/unittests/Tooling/SourceCodeTest.cpp b/clang/unittests/Tooling/SourceCodeTest.cpp --- a/clang/unittests/Tooling/SourceCodeTest.cpp +++ b/clang/unittests/Tooling/SourceCodeTest.cpp @@ -247,14 +247,12 @@ // Includes attributes. Visitor.runOverAnnotated(R"cpp( - #define ATTR __attribute__((deprecated("message"))) - $r[[ATTR + $r[[__attribute__((deprecated("message"))) int x;]])cpp"); // Includes attributes and comments together. Visitor.runOverAnnotated(R"cpp( - #define ATTR __attribute__((deprecated("message"))) - $r[[ATTR + $r[[__attribute__((deprecated("message"))) // Comment. int x;]])cpp"); } @@ -402,14 +400,12 @@ // Includes attributes. Visit(R"cpp( - #define ATTR __attribute__((deprecated("message"))) - $r[[ATTR + $r[[__attribute__((deprecated("message"))) int x;]])cpp"); // Includes attributes and comments together. Visit(R"cpp( - #define ATTR __attribute__((deprecated("message"))) - $r[[ATTR + $r[[__attribute__((deprecated("message"))) // Comment. int x;]])cpp"); }