aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-02-21 01:47:08 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-02-21 01:47:08 +0000
commit65124fe81f61eed98b845c87e3a78a780f3deb11 (patch)
tree2b8502d4a4c19bd089d16c13767674285e237afc
parent11f0cae4bf4f62dcc706d33c1f795d460cd64816 (diff)
Rename TypeLoc's isType to isKind
Matches changes made to SVal's similar functions based on Jordan Rose's review feedback to r175594. Also change isKind to take a reference rather than a non-null pointer, while I'm at it. (& make TypeLoc::isKind private) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175704 91177308-0d34-0410-b5e6-96231b3b80d8
-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