2008-02-14 10:14:34 +03:00
|
|
|
//===--- Attr.h - Classes for representing expressions ----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the Attr interface and subclasses.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-02-14 10:43:43 +03:00
|
|
|
#ifndef LLVM_CLANG_AST_ATTR_H
|
|
|
|
#define LLVM_CLANG_AST_ATTR_H
|
2008-02-14 10:14:34 +03:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
|
|
|
|
/// Attr - This represents one attribute.
|
|
|
|
class Attr {
|
|
|
|
public:
|
|
|
|
enum Kind {
|
|
|
|
Aligned,
|
2008-02-14 10:43:43 +03:00
|
|
|
Packed
|
2008-02-14 10:14:34 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2008-02-14 10:43:43 +03:00
|
|
|
Attr *Next;
|
2008-02-14 10:14:34 +03:00
|
|
|
Kind AttrKind;
|
|
|
|
|
|
|
|
protected:
|
2008-02-15 10:04:12 +03:00
|
|
|
Attr(Kind AK) : Next(0), AttrKind(AK) {}
|
2008-02-16 02:30:50 +03:00
|
|
|
public:
|
2008-02-14 10:14:34 +03:00
|
|
|
virtual ~Attr() {
|
2008-02-14 10:43:43 +03:00
|
|
|
delete Next;
|
2008-02-14 10:14:34 +03:00
|
|
|
}
|
2008-02-16 02:30:50 +03:00
|
|
|
|
2008-02-14 10:14:34 +03:00
|
|
|
Kind getKind() const { return AttrKind; }
|
|
|
|
|
2008-02-14 10:43:43 +03:00
|
|
|
Attr *getNext() { return Next; }
|
|
|
|
const Attr *getNext() const { return Next; }
|
|
|
|
void setNext(Attr *next) { Next = next; }
|
2008-02-14 10:14:34 +03:00
|
|
|
|
|
|
|
void addAttr(Attr *attr) {
|
|
|
|
assert((attr != 0) && "addAttr(): attr is null");
|
2008-02-14 10:43:43 +03:00
|
|
|
|
|
|
|
// FIXME: This doesn't preserve the order in any way.
|
|
|
|
attr->Next = Next;
|
|
|
|
Next = attr;
|
2008-02-14 10:14:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Implement isa/cast/dyncast/etc.
|
|
|
|
static bool classof(const Attr *) { return true; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class PackedAttr : public Attr {
|
|
|
|
public:
|
|
|
|
PackedAttr() : Attr(Packed) {}
|
|
|
|
|
|
|
|
// Implement isa/cast/dyncast/etc.
|
|
|
|
static bool classof(const Attr *A) {
|
|
|
|
return A->getKind() == Packed;
|
|
|
|
}
|
|
|
|
static bool classof(const PackedAttr *A) { return true; }
|
|
|
|
};
|
2008-02-14 10:43:43 +03:00
|
|
|
|
2008-02-14 10:14:34 +03:00
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|