aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/Attr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/Attr.h')
-rw-r--r--include/clang/AST/Attr.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index 719023926bae..cf2e3c5d25b6 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -14,18 +14,18 @@
#ifndef LLVM_CLANG_AST_ATTR_H
#define LLVM_CLANG_AST_ATTR_H
-#include "llvm/Support/Casting.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSwitch.h"
+#include "clang/Basic/LLVM.h"
#include "clang/Basic/AttrKinds.h"
#include "clang/AST/Type.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/VersionTuple.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstring>
#include <algorithm>
-using llvm::dyn_cast;
namespace clang {
class ASTContext;
@@ -58,7 +58,7 @@ namespace clang {
/// Attr - This represents one attribute.
class Attr {
private:
- SourceLocation Loc;
+ SourceRange Range;
unsigned AttrKind : 16;
protected:
@@ -67,11 +67,10 @@ protected:
virtual ~Attr();
void* operator new(size_t bytes) throw() {
- assert(0 && "Attrs cannot be allocated with regular 'new'.");
- return 0;
+ llvm_unreachable("Attrs cannot be allocated with regular 'new'.");
}
void operator delete(void* data) throw() {
- assert(0 && "Attrs cannot be released with regular 'delete'.");
+ llvm_unreachable("Attrs cannot be released with regular 'delete'.");
}
public:
@@ -86,8 +85,8 @@ public:
}
protected:
- Attr(attr::Kind AK, SourceLocation L)
- : Loc(L), AttrKind(AK), Inherited(false) {}
+ Attr(attr::Kind AK, SourceRange R)
+ : Range(R), AttrKind(AK), Inherited(false) {}
public:
@@ -95,8 +94,9 @@ public:
return static_cast<attr::Kind>(AttrKind);
}
- SourceLocation getLocation() const { return Loc; }
- void setLocation(SourceLocation L) { Loc = L; }
+ SourceLocation getLocation() const { return Range.getBegin(); }
+ SourceRange getRange() const { return Range; }
+ void setRange(SourceRange R) { Range = R; }
bool isInherited() const { return Inherited; }
@@ -109,8 +109,8 @@ public:
class InheritableAttr : public Attr {
protected:
- InheritableAttr(attr::Kind AK, SourceLocation L)
- : Attr(AK, L) {}
+ InheritableAttr(attr::Kind AK, SourceRange R)
+ : Attr(AK, R) {}
public:
void setInherited(bool I) { Inherited = I; }
@@ -124,8 +124,8 @@ public:
class InheritableParamAttr : public InheritableAttr {
protected:
- InheritableParamAttr(attr::Kind AK, SourceLocation L)
- : InheritableAttr(AK, L) {}
+ InheritableParamAttr(attr::Kind AK, SourceRange R)
+ : InheritableAttr(AK, R) {}
public:
// Implement isa/cast/dyncast/etc.
@@ -138,8 +138,8 @@ public:
#include "clang/AST/Attrs.inc"
/// AttrVec - A vector of Attr, which is how they are stored on the AST.
-typedef llvm::SmallVector<Attr*, 2> AttrVec;
-typedef llvm::SmallVector<const Attr*, 2> ConstAttrVec;
+typedef SmallVector<Attr*, 2> AttrVec;
+typedef SmallVector<const Attr*, 2> ConstAttrVec;
/// DestroyAttrs - Destroy the contents of an AttrVec.
inline void DestroyAttrs (AttrVec& V, ASTContext &C) {
@@ -159,12 +159,12 @@ class specific_attr_iterator {
mutable AttrVec::const_iterator Current;
void AdvanceToNext() const {
- while (!llvm::isa<SpecificAttr>(*Current))
+ while (!isa<SpecificAttr>(*Current))
++Current;
}
void AdvanceToNext(AttrVec::const_iterator I) const {
- while (Current != I && !llvm::isa<SpecificAttr>(*Current))
+ while (Current != I && !isa<SpecificAttr>(*Current))
++Current;
}
@@ -180,11 +180,11 @@ public:
reference operator*() const {
AdvanceToNext();
- return llvm::cast<SpecificAttr>(*Current);
+ return cast<SpecificAttr>(*Current);
}
pointer operator->() const {
AdvanceToNext();
- return llvm::cast<SpecificAttr>(*Current);
+ return cast<SpecificAttr>(*Current);
}
specific_attr_iterator& operator++() {