summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-04-23 17:44:58 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-04-23 17:44:58 +0000
commit5828a1d8e9e9876a89ddd52b8f5160723cfbdfda (patch)
tree3ae49f99b0cb4fcae0289abacca1948170041412 /lib/CodeGen/CGExprConstant.cpp
parent022878f852c61803d260da295a8f905aaf2edad6 (diff)
downloadclang-5828a1d8e9e9876a89ddd52b8f5160723cfbdfda.tar.gz
clang-5828a1d8e9e9876a89ddd52b8f5160723cfbdfda.tar.bz2
clang-5828a1d8e9e9876a89ddd52b8f5160723cfbdfda.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index bce0475cbc..4e615922fe 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/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.