From: Anders Carlsson Date: Thu, 14 Feb 2008 07:43:43 +0000 (+0000) Subject: Address comments from Chris. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81226601148d7e7c187b96c6ef86e83df204f59f;p=clang Address comments from Chris. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47118 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h index 39de4faac9..dc65cc70dc 100644 --- a/include/clang/AST/Attr.h +++ b/include/clang/AST/Attr.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_AST_EXPR_H -#define LLVM_CLANG_AST_EXPR_H +#ifndef LLVM_CLANG_AST_ATTR_H +#define LLVM_CLANG_AST_ATTR_H namespace clang { @@ -20,39 +20,33 @@ namespace clang { class Attr { public: enum Kind { - AddressSpace, Aligned, - OCUVectorType, - Packed, - VectorSize + Packed }; private: - Attr *next; - + Attr *Next; Kind AttrKind; protected: Attr(Kind AK) : AttrKind(AK) {} virtual ~Attr() { - if (Next) - delete Next; + delete Next; } public: Kind getKind() const { return AttrKind; } - Attr *getNext() const { return Next; } - void setNext(Attr *N) { Next = N; } + 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"); - Attr *next = this, *prev; - do { - prev = next; - next = next->getNext(); - } while (next); - prev->setNext(attr); + + // FIXME: This doesn't preserve the order in any way. + attr->Next = Next; + Next = attr; } // Implement isa/cast/dyncast/etc. @@ -69,7 +63,7 @@ public: } static bool classof(const PackedAttr *A) { return true; } }; - + } // end namespace clang #endif