r175704 - Rename TypeLoc's isType to isKind

David Blaikie dblaikie at gmail.com
Wed Feb 20 17:47:08 PST 2013


Author: dblaikie
Date: Wed Feb 20 19:47:08 2013
New Revision: 175704

URL: http://llvm.org/viewvc/llvm-project?rev=175704&view=rev
Log:
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)

Modified:
    cfe/trunk/include/clang/AST/TypeLoc.h
    cfe/trunk/lib/AST/TypeLoc.cpp

Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=175704&r1=175703&r2=175704&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Wed Feb 20 19:47:08 2013
@@ -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
     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;
 }

Modified: cfe/trunk/lib/AST/TypeLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeLoc.cpp?rev=175704&r1=175703&r2=175704&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypeLoc.cpp (original)
+++ cfe/trunk/lib/AST/TypeLoc.cpp Wed Feb 20 19:47:08 2013
@@ -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





More information about the cfe-commits mailing list