aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-02-15 23:57:38 +0000
committerAnders Carlsson <andersca@mac.com>2008-02-15 23:57:38 +0000
commitadf21bdb3d17acfdb74657fcbc5035a404c6c8f4 (patch)
treef0cb34169c7ff516c017e4e782162d5f8b6d1c50
parentb0dd26825e58a5f2982fd6d4ffa4c4ae6e24ff17 (diff)
Store attributes in a global hash map instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47193 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Attr.h2
-rw-r--r--include/clang/AST/Decl.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index 82da65a89b..ae2c25b11b 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -14,6 +14,8 @@
#ifndef LLVM_CLANG_AST_ATTR_H
#define LLVM_CLANG_AST_ATTR_H
+#include <assert.h>
+
namespace clang {
/// Attr - This represents one attribute.
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 32127bb3a9..0fbf0f9285 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_AST_DECL_H
#define LLVM_CLANG_AST_DECL_H
+#include "clang/AST/Attr.h"
#include "clang/AST/Type.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/APSInt.h"
@@ -24,7 +25,6 @@ class Decl;
}
namespace clang {
-class Attr;
class Expr;
class Stmt;
class StringLiteral;
@@ -138,6 +138,14 @@ public:
void addAttr(Attr *attr);
const Attr *getAttrs() const;
+ template<typename T> T *getAttr() {
+ for (Attr *attr = getAttrs(); attr; attr = attr->getNext())
+ if (isa<T>(attr))
+ return cast<T>(attr);
+
+ return 0;
+ }
+
/// setInvalidDecl - Indicates the Decl had a semantic error. This
/// allows for graceful error recovery.
void setInvalidDecl() { InvalidDecl = 1; }