1 //===--- SemaStmtAttr.cpp - Statement Attribute Handling ------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements stmt-related attribute processing.
12 //===----------------------------------------------------------------------===//
14 #include "clang/Sema/SemaInternal.h"
15 #include "TargetAttributesSema.h"
16 #include "clang/AST/ASTContext.h"
17 #include "clang/Basic/SourceManager.h"
18 #include "clang/Sema/DelayedDiagnostic.h"
19 #include "clang/Sema/Lookup.h"
20 #include "llvm/ADT/StringExtras.h"
21 using namespace clang;
25 static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A) {
26 switch (A.getKind()) {
28 // if we're here, then we parsed an attribute, but didn't recognize it as a
29 // statement attribute => it is declaration attribute
30 S.Diag(A.getRange().getBegin(), diag::warn_attribute_invalid_on_stmt) <<
31 A.getName()->getName();
36 StmtResult Sema::ProcessStmtAttributes(Stmt *S, AttributeList *AttrList,
39 for (const AttributeList* l = AttrList; l; l = l->getNext()) {
40 if (Attr *a = ProcessStmtAttribute(*this, S, *l))
47 return ActOnAttributedStmt(Range.getBegin(), Attrs, S);