summaryrefslogtreecommitdiffstats
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
commitc4071fe13d8e02d821a5d3249dc26500a30778f2 (patch)
tree2e86fc58eb06118438c12ca7a685f6473820adf6
parentd1c7cf26ae622ed911ee6d746313dfbedcdfd012 (diff)
downloadbcm5719-llvm-c4071fe13d8e02d821a5d3249dc26500a30778f2.tar.gz
bcm5719-llvm-c4071fe13d8e02d821a5d3249dc26500a30778f2.zip
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) llvm-svn: 175704
-rw-r--r--clang/include/clang/AST/TypeLoc.h36
-rw-r--r--clang/lib/AST/TypeLoc.cpp6
2 files changed, 21 insertions, 21 deletions
diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h
index 147643c1e56..11cad9bb9dd 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/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/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp
index fe66714e4d7..03d40309f53 100644
--- a/clang/lib/AST/TypeLoc.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud