diff options
Diffstat (limited to 'lib/Sema/SemaStmtAttr.cpp')
-rw-r--r-- | lib/Sema/SemaStmtAttr.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Sema/SemaStmtAttr.cpp b/lib/Sema/SemaStmtAttr.cpp index e55e20c2827f..e39a65c6ce0c 100644 --- a/lib/Sema/SemaStmtAttr.cpp +++ b/lib/Sema/SemaStmtAttr.cpp @@ -23,7 +23,7 @@ using namespace clang; using namespace sema; -static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const AttributeList &A, +static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { FallThroughAttr Attr(A.getRange(), S.Context, A.getAttributeSpellingListIndex()); @@ -53,7 +53,7 @@ static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const AttributeList &A, return ::new (S.Context) auto(Attr); } -static Attr *handleSuppressAttr(Sema &S, Stmt *St, const AttributeList &A, +static Attr *handleSuppressAttr(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { if (A.getNumArgs() < 1) { S.Diag(A.getLoc(), diag::err_attribute_too_few_arguments) @@ -78,7 +78,7 @@ static Attr *handleSuppressAttr(Sema &S, Stmt *St, const AttributeList &A, DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex()); } -static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const AttributeList &A, +static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange) { IdentifierLoc *PragmaNameLoc = A.getArgAsIdent(0); IdentifierLoc *OptionLoc = A.getArgAsIdent(1); @@ -246,7 +246,7 @@ CheckForIncompatibleAttributes(Sema &S, } } -static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const AttributeList &A, +static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { // Although the feature was introduced only in OpenCL C v2.0 s6.11.5, it's // useful for OpenCL 1.x too and doesn't require HW support. @@ -288,21 +288,21 @@ static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const AttributeList &A, return OpenCLUnrollHintAttr::CreateImplicit(S.Context, UnrollFactor); } -static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A, +static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { switch (A.getKind()) { - case AttributeList::UnknownAttribute: + case ParsedAttr::UnknownAttribute: S.Diag(A.getLoc(), A.isDeclspecAttribute() ? diag::warn_unhandled_ms_attribute_ignored : diag::warn_unknown_attribute_ignored) << A.getName(); return nullptr; - case AttributeList::AT_FallThrough: + case ParsedAttr::AT_FallThrough: return handleFallThroughAttr(S, St, A, Range); - case AttributeList::AT_LoopHint: + case ParsedAttr::AT_LoopHint: return handleLoopHintAttr(S, St, A, Range); - case AttributeList::AT_OpenCLUnrollHint: + case ParsedAttr::AT_OpenCLUnrollHint: return handleOpenCLUnrollHint(S, St, A, Range); - case AttributeList::AT_Suppress: + case ParsedAttr::AT_Suppress: return handleSuppressAttr(S, St, A, Range); default: // if we're here, then we parsed a known attribute, but didn't recognize @@ -313,11 +313,12 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A, } } -StmtResult Sema::ProcessStmtAttributes(Stmt *S, AttributeList *AttrList, +StmtResult Sema::ProcessStmtAttributes(Stmt *S, + const ParsedAttributesView &AttrList, SourceRange Range) { SmallVector<const Attr*, 8> Attrs; - for (const AttributeList* l = AttrList; l; l = l->getNext()) { - if (Attr *a = ProcessStmtAttribute(*this, S, *l, Range)) + for (const ParsedAttr &AL : AttrList) { + if (Attr *a = ProcessStmtAttribute(*this, S, AL, Range)) Attrs.push_back(a); } |