diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-04-23 17:44:58 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-04-23 17:44:58 +0000 |
commit | 9da2a799abd809770efab64555321c01987cd591 (patch) | |
tree | 63b3df4816acf104de04d975e89541b84b4729e2 /clang/lib/CodeGen/CGExprConstant.cpp | |
parent | eb08c4f038954ac8a25839cec7198285fcf58d22 (diff) | |
download | bcm5719-llvm-9da2a799abd809770efab64555321c01987cd591.tar.gz bcm5719-llvm-9da2a799abd809770efab64555321c01987cd591.zip |
Objective-C [IRGen]. Fixes a crash in IRGen involving use of
'typeof' to extract type of an @encode expression used
in an initializer. // rdar://16655340
llvm-svn: 207004
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index bce0475cbc0..4e615922fe2 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -836,7 +836,10 @@ public: // as an inline array. std::string Str; CGM.getContext().getObjCEncodingForType(E->getEncodedType(), Str); - const ConstantArrayType *CAT = cast<ConstantArrayType>(E->getType()); + QualType T = E->getType(); + if (T->getTypeClass() == Type::TypeOfExpr) + T = cast<TypeOfExprType>(T)->getUnderlyingExpr()->getType(); + const ConstantArrayType *CAT = cast<ConstantArrayType>(T); // Resize the string to the right size, adding zeros at the end, or // truncating as needed. |