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

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 10:57:06 PST 2017


OK. Merged in r293797.

Thanks,
Hans

On Wed, Feb 1, 2017 at 9:50 AM, Alex L <arphaman at gmail.com> wrote:
> Hi Hans,
>
> Would it be possible to merge this for 4.0?
>
> Cheers,
> Alex
>
> On 1 February 2017 at 17:37, Alex Lorenz via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>>
>> Author: arphaman
>> Date: Wed Feb  1 11:37:28 2017
>> New Revision: 293787
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=293787&view=rev
>> Log:
>> [CodeGen][ObjC] Avoid asserting on block pointer types in
>> isPointerZeroInitializable
>>
>> rdar://30111891
>>
>> Added:
>>     cfe/trunk/test/CodeGenObjC/block-ptr-type-crash.m
>> Modified:
>>     cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=293787&r1=293786&r2=293787&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Feb  1 11:37:28 2017
>> @@ -738,7 +738,7 @@ CodeGenTypes::getCGRecordLayout(const Re
>>  }
>>
>>  bool CodeGenTypes::isPointerZeroInitializable(QualType T) {
>> -  assert (T->isAnyPointerType() && "Invalid type");
>> +  assert((T->isAnyPointerType() || T->isBlockPointerType()) && "Invalid
>> type");
>>    return isZeroInitializable(T);
>>  }
>>
>>
>> Added: cfe/trunk/test/CodeGenObjC/block-ptr-type-crash.m
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/block-ptr-type-crash.m?rev=293787&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenObjC/block-ptr-type-crash.m (added)
>> +++ cfe/trunk/test/CodeGenObjC/block-ptr-type-crash.m Wed Feb  1 11:37:28
>> 2017
>> @@ -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)();
>> + at interface MyClass
>> + at end
>> + at implementation MyClass
>> +- (void)_doStuff {
>> +  struct {
>> +    int identifier;
>> +    AnEnum type;
>> +    BlockType handler;
>> +  } var = {
>> +    "hello",
>> +    AnEnumA,
>> +    ((void *)0)
>> +  };
>> +}
>> + at end
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>


More information about the cfe-commits mailing list