C++11 attributes attached to a statement

Hi all,

I’m adding some new non-standard C++ attributes in clang. I’m using this link

http://clang.llvm.org/docs/InternalsManual.html#include-clang-basic-attr-td

I added an C++11 attribute in clang attached to a Function,

  • include/clang/Basic/Attr.td

def CXX11MYOWNAttr : InheritableAttr {
let Spellings = [CXX11<“my”,“ownattr”, 201412>];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [Undocumented];

}

  • lib/Sema/SemaDeclAttr.cpp

in ProcessDeclAttribute function:

case AttributeList::AT_CXX11MYOWNAttr:
handleSimpleAttribute<CXX11MYOWNAttr>(S, D, Attr);
break;
}

however, I would like to include this to a statement.

Any help?

Thanks.

Hi!

I the easiest way for you to add a C++11 attribute to a statement is to follow the LoopHint attribute through the code.

The attribute is handled in ./lib/Sema/SemaStmtAttr.cpp

Cheers,
Michael Haidl

LoopHint isn't quite the one I would model after since that's a
pragma. FallThrough, however, is a good statement attribute to model
after. And the semantic handling for statement attributes is in
SemaStmtAttr.cpp, as Michael points out.

~Aaron