diff options
author | Alex Lorenz <arphaman@gmail.com> | 2018-08-17 22:18:08 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2018-08-17 22:18:08 +0000 |
commit | b111da14ada1c8bba8a1ce4ed903ffc66627646c (patch) | |
tree | 7e0710f5f6f7a650682cb5f37e9195c378b92a72 /clang/test/CodeGenObjC/protocol-comdat.m | |
parent | 4c33d197fa77b9434a7e76d9ee80005de58a0026 (diff) | |
download | llvm-b111da14ada1c8bba8a1ce4ed903ffc66627646c.zip llvm-b111da14ada1c8bba8a1ce4ed903ffc66627646c.tar.gz llvm-b111da14ada1c8bba8a1ce4ed903ffc66627646c.tar.bz2 |
[ObjC] Error out when using forward-declared protocol in a @protocol
expression
Clang emits invalid protocol metadata when a @protocol expression is used with a
forward-declared protocol. The protocol metadata is missing protocol conformance
list of the protocol since we don't have access to the definition of it in the
compiled translation unit. The linker then might end up picking the invalid
metadata when linking which will lead to incorrect runtime protocol conformance
checks.
This commit makes sure that Clang fails to compile code that uses a @protocol
expression with a forward-declared protocol. This ensures that Clang does not
emit invalid protocol metadata. I added an extra assert in CodeGen to ensure
that this kind of issue won't happen in other places.
rdar://32787811
Differential Revision: https://reviews.llvm.org/D49462
llvm-svn: 340102
Diffstat (limited to 'clang/test/CodeGenObjC/protocol-comdat.m')
-rw-r--r-- | clang/test/CodeGenObjC/protocol-comdat.m | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/CodeGenObjC/protocol-comdat.m b/clang/test/CodeGenObjC/protocol-comdat.m index a19ba8c..ddf8e5a 100644 --- a/clang/test/CodeGenObjC/protocol-comdat.m +++ b/clang/test/CodeGenObjC/protocol-comdat.m @@ -4,8 +4,8 @@ - (void) method; @end -@protocol Q; -@protocol R; +@protocol Q @end +@protocol R @end @interface I<P> @end |