diff options
Diffstat (limited to 'clang/lib/Sema/SemaStmtAttr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaStmtAttr.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index e819d96470c..3d91893b406 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -23,8 +23,7 @@ using namespace sema; static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { - FallThroughAttr Attr(A.getRange(), S.Context, - A.getAttributeSpellingListIndex()); + FallThroughAttr Attr(S.Context, A); if (!isa<NullStmt>(St)) { S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_wrong_target) << Attr.getSpelling() << St->getBeginLoc(); @@ -45,10 +44,10 @@ static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const ParsedAttr &A, // about using it as an extension. if (!S.getLangOpts().CPlusPlus17 && A.isCXX11Attribute() && !A.getScopeName()) - S.Diag(A.getLoc(), diag::ext_cxx17_attr) << A.getName(); + S.Diag(A.getLoc(), diag::ext_cxx17_attr) << A; FnScope->setHasFallthroughStmt(); - return ::new (S.Context) auto(Attr); + return ::new (S.Context) FallThroughAttr(S.Context, A); } static Attr *handleSuppressAttr(Sema &S, Stmt *St, const ParsedAttr &A, @@ -71,8 +70,7 @@ static Attr *handleSuppressAttr(Sema &S, Stmt *St, const ParsedAttr &A, } return ::new (S.Context) SuppressAttr( - A.getRange(), S.Context, DiagnosticIdentifiers.data(), - DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex()); + S.Context, A, DiagnosticIdentifiers.data(), DiagnosticIdentifiers.size()); } static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, @@ -97,8 +95,6 @@ static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, return nullptr; } - LoopHintAttr::Spelling Spelling = - LoopHintAttr::Spelling(A.getAttributeSpellingListIndex()); LoopHintAttr::OptionType Option; LoopHintAttr::LoopHintState State; @@ -171,8 +167,7 @@ static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, llvm_unreachable("bad loop hint"); } - return LoopHintAttr::CreateImplicit(S.Context, Spelling, Option, State, - ValueExpr, A.getRange()); + return LoopHintAttr::CreateImplicit(S.Context, Option, State, ValueExpr, A); } static void @@ -330,7 +325,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A, S.Diag(A.getLoc(), A.isDeclspecAttribute() ? (unsigned)diag::warn_unhandled_ms_attribute_ignored : (unsigned)diag::warn_unknown_attribute_ignored) - << A.getName(); + << A; return nullptr; case ParsedAttr::AT_FallThrough: return handleFallThroughAttr(S, St, A, Range); @@ -344,7 +339,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A, // if we're here, then we parsed a known attribute, but didn't recognize // it as a statement attribute => it is declaration attribute S.Diag(A.getRange().getBegin(), diag::err_decl_attribute_invalid_on_stmt) - << A.getName() << St->getBeginLoc(); + << A << St->getBeginLoc(); return nullptr; } } |

