1 //===--- AttributeList.h ----------------------------------------*- C++ -*-===//
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 defines the AttributeList class interface.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_ATTRLIST_H
15 #define LLVM_CLANG_ATTRLIST_H
17 #include "clang/Parse/Action.h"
22 /// AttributeList - Represents GCC's __attribute__ declaration. There are
23 /// 4 forms of this construct...they are:
25 /// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
26 /// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
27 /// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
28 /// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
31 IdentifierInfo *AttrName;
32 SourceLocation AttrLoc;
33 IdentifierInfo *ParmName;
34 SourceLocation ParmLoc;
35 Action::ExprTy **Args;
39 AttributeList(IdentifierInfo *AttrName, SourceLocation AttrLoc,
40 IdentifierInfo *ParmName, SourceLocation ParmLoc,
41 Action::ExprTy **args, unsigned numargs, AttributeList *Next);
53 IdentifierInfo *getAttributeName() const { return AttrName; }
54 SourceLocation getAttributeLoc() const { return AttrLoc; }
55 IdentifierInfo *getParameterName() const { return ParmName; }
57 Kind getKind() const { return getKind(getAttributeName()); }
58 static Kind getKind(const IdentifierInfo *Name);
60 AttributeList *getNext() const { return Next; }
61 void setNext(AttributeList *N) { Next = N; }
63 void addAttributeList(AttributeList *alist) {
64 assert((alist != 0) && "addAttributeList(): alist is null");
65 AttributeList *next = this, *prev;
68 next = next->getNext();
73 /// getNumArgs - Return the number of actual arguments to this attribute.
74 unsigned getNumArgs() const { return NumArgs; }
76 /// getArg - Return the specified argument.
77 Action::ExprTy *getArg(unsigned Arg) const {
78 assert(Arg < NumArgs && "Arg access out of range!");
83 } // end namespace clang