"Attribute" Translation

Hey all,

Could anyone give me any hint on how llvm-g++ translates the
"__attribute__" annotations (supported by GCC)?
(Has GCC already implemented the support for the C++0x attributes?)

Suppose a class definition as below:

template <typename T>
class __attribute__((may_alias)) list { ... };

I understand that each particular attribute may be handled
differently. Assuming that I want to retain one attribute in the LLVM
IR, how is the attribute represented in the LLVM IR? And then how can
I query the attribute assuming that the attribute is appertained to a
class?

By the way, I am very grateful for any idea on extending the compiler
with new attribute tokens?

Best,
Xiaolong

Hi Xiaolong,

Could anyone give me any hint on how llvm-g++ translates the
"__attribute__" annotations (supported by GCC)?

most attributes are ignored. Those that are not ignored are usually
converted into an LLVM parameter or function attribute, see
   http://llvm.org/docs/LangRef.html#paramattrs
and
   http://llvm.org/docs/LangRef.html#fnattrs

template<typename T>
class __attribute__((may_alias)) list { ... };

In LLVM, attributes are not placed on types, instead they are placed
on operations (eg: where gcc has an attribute on a function type, LLVM
will place the attribute on calls to a function of that type).

Ciao,

Duncan.