diff options
Diffstat (limited to 'AST/Type.cpp')
-rw-r--r-- | AST/Type.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/AST/Type.cpp b/AST/Type.cpp index 4e415e4ab6..b09d3afa63 100644 --- a/AST/Type.cpp +++ b/AST/Type.cpp @@ -84,8 +84,16 @@ const ReferenceType *Type::isReferenceType() const { return 0; } -bool Type::isArrayType() const { - return isa<ArrayType>(CanonicalType); +const ArrayType *Type::isArrayType() const { + // If this is directly a reference type, return it. + if (const ArrayType *ATy = dyn_cast<ArrayType>(this)) + return ATy; + + // If this is a typedef for an array type, strip the typedef off without + // losing all typedef information. + if (isa<ArrayType>(CanonicalType)) + return cast<ArrayType>(cast<TypedefType>(this)->LookThroughTypedefs()); + return 0; } bool Type::isStructureType() const { |