[CodeGen][ObjC] Avoid asserting on block pointer types in

isPointerZeroInitializable

rdar://30111891

llvm-svn: 293787
This commit is contained in:
Alex Lorenz 2017-02-01 17:37:28 +00:00
parent d3820b66f2
commit 86d3232daf
2 changed files with 29 additions and 1 deletions

View File

@ -738,7 +738,7 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) {
}
bool CodeGenTypes::isPointerZeroInitializable(QualType T) {
assert (T->isAnyPointerType() && "Invalid type");
assert((T->isAnyPointerType() || T->isBlockPointerType()) && "Invalid type");
return isZeroInitializable(T);
}

View File

@ -0,0 +1,28 @@
// RUN: %clang_cc1 -Wno-objc-root-class -fblocks -o /dev/null -triple x86_64-- -emit-llvm %s
// REQUIRES: asserts
// Verify there is no assertion.
// rdar://30111891
typedef unsigned long long uint64_t;
typedef enum AnEnum : uint64_t AnEnum;
enum AnEnum: uint64_t {
AnEnumA
};
typedef void (^BlockType)();
@interface MyClass
@end
@implementation MyClass
- (void)_doStuff {
struct {
int identifier;
AnEnum type;
BlockType handler;
} var = {
"hello",
AnEnumA,
((void *)0)
};
}
@end