forked from OSchip/llvm-project
Store attributes in a global hash map instead.
llvm-svn: 47193
This commit is contained in:
parent
e1f41fc68e
commit
8321a155a5
|
@ -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.
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue