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 | 07bab73c7f0a8dc8477c69d8b744b98610dd9304 (patch) | |
tree | 4bdf0b814e01f27424462ac0950645d14d141d84 /clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp | |
parent | 6262bbf819a0bc04871835011d71eb48dc7f0784 (diff) | |
download | bcm5719-llvm-07bab73c7f0a8dc8477c69d8b744b98610dd9304.tar.gz bcm5719-llvm-07bab73c7f0a8dc8477c69d8b744b98610dd9304.zip |
Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced. <rdar://problem/12858424>.
llvm-svn: 170081
Diffstat (limited to 'clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp')
-rw-r--r-- | clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 93f36ee7f83..81e334e2126 100644 --- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/clang/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"; |