diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-12-13 01:43:21 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-12-13 01:43:21 +0000 |
commit | 6febf1265b5a5c3025752193caa9714ed523b12d (patch) | |
tree | 8bfacd3582a25b00ca99af5f51b3609d3ff3a6e0 /lib/Rewrite/Frontend/RewriteModernObjC.cpp | |
parent | 93ca0217a2aa3047c10518e991ab8578e90829e7 (diff) |
Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced. <rdar://problem/12858424>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/Frontend/RewriteModernObjC.cpp')
-rw-r--r-- | lib/Rewrite/Frontend/RewriteModernObjC.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 93f36ee7f8..81e334e212 100644 --- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -3842,16 +3842,16 @@ void RewriteModernObjC::RewriteObjCFieldDecl(FieldDecl *fieldDecl, Result += " : "; Result += utostr(fieldDecl->getBitWidthValue(*Context)); } else if (EleboratedType && Type->isArrayType()) { - CanQualType CType = Context->getCanonicalType(Type); - while (isa<ArrayType>(CType)) { - if (const ConstantArrayType *CAT = Context->getAsConstantArrayType(CType)) { + const ArrayType *AT = Context->getAsArrayType(Type); + do { + if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT)) { Result += "["; llvm::APInt Dim = CAT->getSize(); Result += utostr(Dim.getZExtValue()); Result += "]"; } - CType = CType->getAs<ArrayType>()->getElementType(); - } + AT = Context->getAsArrayType(AT->getElementType()); + } while (AT); } Result += ";\n"; |