summaryrefslogtreecommitdiffstats
path: root/clang/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
commit9da2a799abd809770efab64555321c01987cd591 (patch)
tree63b3df4816acf104de04d975e89541b84b4729e2 /clang/lib/CodeGen/CGExprConstant.cpp
parenteb08c4f038954ac8a25839cec7198285fcf58d22 (diff)
downloadbcm5719-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.cpp5
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.
OpenPOWER on IntegriCloud