aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/TypeLoc.h36
-rw-r--r--lib/AST/TypeLoc.cpp6
2 files changed, 21 insertions, 21 deletions
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index 147643c1e5..11cad9bb9d 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -48,7 +48,7 @@ public:
/// is of the desired type.
template<typename T>
T castAs() const {
- assert(T::isType(this));
+ assert(T::isKind(*this));
T t;
TypeLoc& tl = t;
tl = *this;
@@ -59,7 +59,7 @@ public:
/// this TypeLoc is not of the desired type.
template<typename T>
T getAs() const {
- if (!T::isType(this))
+ if (!T::isKind(*this))
return T();
T t;
TypeLoc& tl = t;
@@ -67,10 +67,6 @@ public:
return t;
}
- static bool isType(const TypeLoc*) {
- return true;
- }
-
/// The kinds of TypeLocs. Equivalent to the Type::TypeClass enum,
/// except it also defines a Qualified enum that corresponds to the
/// QualifiedLoc class.
@@ -183,6 +179,10 @@ public:
}
private:
+ static bool isKind(const TypeLoc&) {
+ return true;
+ }
+
static void initializeImpl(ASTContext &Context, TypeLoc TL,
SourceLocation Loc);
static TypeLoc getNextTypeLocImpl(TypeLoc TL);
@@ -212,8 +212,8 @@ public:
private:
friend class TypeLoc;
- static bool isType(const TypeLoc *TL) {
- return !TL->getType().hasLocalQualifiers();
+ static bool isKind(const TypeLoc &TL) {
+ return !TL.getType().hasLocalQualifiers();
}
};
@@ -258,8 +258,8 @@ public:
private:
friend class TypeLoc;
- static bool isType(const TypeLoc *TL) {
- return TL->getType().hasLocalQualifiers();
+ static bool isKind(const TypeLoc &TL) {
+ return TL.getType().hasLocalQualifiers();
}
};
@@ -308,8 +308,8 @@ class ConcreteTypeLoc : public Base {
}
friend class TypeLoc;
- static bool isType(const TypeLoc *TL) {
- return Derived::classofType(TL->getTypePtr());
+ static bool isKind(const TypeLoc &TL) {
+ return Derived::classofType(TL.getTypePtr());
}
static bool classofType(const Type *Ty) {
@@ -392,11 +392,11 @@ class InheritingConcreteTypeLoc : public Base {
return TypeClass::classof(Ty);
}
- static bool isType(const TypeLoc *TL) {
- return Derived::classofType(TL->getTypePtr());
+ static bool isKind(const TypeLoc &TL) {
+ return Derived::classofType(TL.getTypePtr());
}
- static bool isType(const UnqualTypeLoc *TL) {
- return Derived::classofType(TL->getTypePtr());
+ static bool isKind(const UnqualTypeLoc &TL) {
+ return Derived::classofType(TL.getTypePtr());
}
public:
@@ -434,7 +434,7 @@ public:
private:
friend class TypeLoc;
- static bool isType(const TypeLoc *TL);
+ static bool isKind(const TypeLoc &TL);
};
@@ -928,7 +928,7 @@ public:
};
inline TypeLoc TypeLoc::IgnoreParens() const {
- if (ParenTypeLoc::isType(this))
+ if (ParenTypeLoc::isKind(*this))
return IgnoreParensImpl(*this);
return *this;
}
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index fe66714e4d..03d40309f5 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -199,9 +199,9 @@ namespace {
/// because it's a convenient base class. Ideally we would not accept
/// those here, but ideally we would have better implementations for
/// them.
-bool TypeSpecTypeLoc::isType(const TypeLoc *TL) {
- if (TL->getType().hasLocalQualifiers()) return false;
- return TSTChecker().Visit(*TL);
+bool TypeSpecTypeLoc::isKind(const TypeLoc &TL) {
+ if (TL.getType().hasLocalQualifiers()) return false;
+ return TSTChecker().Visit(TL);
}
// Reimplemented to account for GNU/C++ extension