mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-22 15:31:00 +00:00
[CodeGen][ObjC] Avoid asserting on block pointer types in
isPointerZeroInitializable rdar://30111891 llvm-svn: 293787
This commit is contained in:
parent
d3820b66f2
commit
86d3232daf
@ -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);
|
||||
}
|
||||
|
||||
|
28
clang/test/CodeGenObjC/block-ptr-type-crash.m
Normal file
28
clang/test/CodeGenObjC/block-ptr-type-crash.m
Normal 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
|
Loading…
Reference in New Issue
Block a user