Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ObjCGNU: Fix empty v3 protocols being emitted two fields short
Summary: Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime. As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid. Reviewers: rjmccall, theraven Reviewed By: rjmccall, theraven Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D45305 llvm-svn: 329882
- Loading branch information
David Chisnall
committed
Apr 12, 2018
1 parent
60874d4
commit 10e590e
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fobjc-runtime=gnustep-1.9 -emit-llvm -o - %s | FileCheck %s | ||
|
||
@protocol X; | ||
|
||
__attribute__((objc_root_class)) | ||
@interface Z <X> | ||
@end | ||
|
||
@implementation Z | ||
@end | ||
|
||
// CHECK: @.objc_protocol_list = internal global { i8*, i32, [0 x i8*] } zeroinitializer, align 4 | ||
// CHECK: @.objc_method_list = internal global { i32, [0 x { i8*, i8* }] } zeroinitializer, align 4 | ||
// CHECK: @.objc_protocol_name = private unnamed_addr constant [2 x i8] c"X\00", align 1 | ||
// CHECK: @.objc_protocol = internal global { i8*, i8*, { i8*, i32, [0 x i8*] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, { i32, [0 x { i8*, i8* }] }*, i8*, i8* } { | ||
// CHECK-SAME: i8* inttoptr (i32 3 to i8*), | ||
// CHECK-SAME: i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.objc_protocol_name, i32 0, i32 0), | ||
// CHECK-SAME: { i8*, i32, [0 x i8*] }* @.objc_protocol_list, | ||
// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list, | ||
// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list, | ||
// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list, | ||
// CHECK-SAME: { i32, [0 x { i8*, i8* }] }* @.objc_method_list, | ||
// CHECK-SAME: i8* null, | ||
// CHECK-SAME: i8* null | ||
// CHECK-SAME: }, align 4 |