зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
11f0cae4bf
Коммит
65124fe81f
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче