Remove PointerLikeType.
- Having pointers and references share a base was not a useful
notion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65567 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 7b07b9c..210be03 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -225,24 +225,6 @@
}
-const PointerLikeType *Type::getAsPointerLikeType() const {
- // If this is directly a pointer-like type, return it.
- if (const PointerLikeType *PTy = dyn_cast<PointerLikeType>(this))
- return PTy;
-
- // If the canonical form of this type isn't the right kind, reject it.
- if (!isa<PointerLikeType>(CanonicalType)) {
- // Look through type qualifiers
- if (isa<PointerLikeType>(CanonicalType.getUnqualifiedType()))
- return CanonicalType.getUnqualifiedType()->getAsPointerLikeType();
- return 0;
- }
-
- // If this is a typedef for a pointer type, strip the typedef off without
- // losing all typedef information.
- return getDesugaredType()->getAsPointerLikeType();
-}
-
const PointerType *Type::getAsPointerType() const {
// If this is directly a pointer type, return it.
if (const PointerType *PTy = dyn_cast<PointerType>(this))
@@ -331,8 +313,10 @@
// Also, C++ references and member pointers can point to a variably modified
// type, where VLAs appear as an extension to C++, and should be treated
// correctly.
- if (const PointerLikeType *PT = getAsPointerLikeType())
+ if (const PointerType *PT = getAsPointerType())
return PT->getPointeeType()->isVariablyModifiedType();
+ if (const ReferenceType *RT = getAsReferenceType())
+ return RT->getPointeeType()->isVariablyModifiedType();
if (const MemberPointerType *PT = getAsMemberPointerType())
return PT->getPointeeType()->isVariablyModifiedType();