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

2017-02-02 Thread Alex L via cfe-commits
Thanks!

On 1 February 2017 at 18:57, Hans Wennborg  wrote:

> OK. Merged in r293797.
>
> Thanks,
> Hans
>
> On Wed, Feb 1, 2017 at 9:50 AM, Alex L  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
> >  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)();
> >> +@interface MyClass
> >> +@end
> >> +@implementation MyClass
> >> +- (void)_doStuff {
> >> +  struct {
> >> +int identifier;
> >> +AnEnum type;
> >> +BlockType handler;
> >> +  } var = {
> >> +"hello",
> >> +AnEnumA,
> >> +((void *)0)
> >> +  };
> >> +}
> >> +@end
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-01 Thread Hans Wennborg via cfe-commits
OK. Merged in r293797.

Thanks,
Hans

On Wed, Feb 1, 2017 at 9:50 AM, Alex L  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
>  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)();
>> +@interface MyClass
>> +@end
>> +@implementation MyClass
>> +- (void)_doStuff {
>> +  struct {
>> +int identifier;
>> +AnEnum type;
>> +BlockType handler;
>> +  } var = {
>> +"hello",
>> +AnEnumA,
>> +((void *)0)
>> +  };
>> +}
>> +@end
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-01 Thread Alex L via cfe-commits
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@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)();
> +@interface MyClass
> +@end
> +@implementation MyClass
> +- (void)_doStuff {
> +  struct {
> +int identifier;
> +AnEnum type;
> +BlockType handler;
> +  } var = {
> +"hello",
> +AnEnumA,
> +((void *)0)
> +  };
> +}
> +@end
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2017-02-01 Thread Alex Lorenz via cfe-commits
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)();
+@interface MyClass
+@end
+@implementation MyClass
+- (void)_doStuff {
+  struct {
+int identifier;
+AnEnum type;
+BlockType handler;
+  } var = {
+"hello",
+AnEnumA,
+((void *)0)
+  };
+}
+@end


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits