blob: 82da65a89bdc83201b2a42386626437d2a90ee7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
//===--- 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.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_ATTR_H
#define LLVM_CLANG_AST_ATTR_H
namespace clang {
/// Attr - This represents one attribute.
class Attr {
public:
enum Kind {
Aligned,
Packed
};
private:
Attr *Next;
Kind AttrKind;
protected:
Attr(Kind AK) : Next(0), AttrKind(AK) {}
public:
virtual ~Attr() {
delete Next;
}
Kind getKind() const { return AttrKind; }
Attr *getNext() { return Next; }
const Attr *getNext() const { return Next; }
void setNext(Attr *next) { Next = next; }
void addAttr(Attr *attr) {
assert((attr != 0) && "addAttr(): attr is null");
// FIXME: This doesn't preserve the order in any way.
attr->Next = Next;
Next = attr;
}
// 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; }
};
} // end namespace clang
#endif
|