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 | b14b766b1c2e712e1b2ccca1418fb0fbb68d0230 (patch) | |
tree | c3e377a44d5869d2872d55cd26487e22ab525409 /include/clang/Basic/DiagnosticGroups.td | |
parent | 24c973171788bbd2699e267a69aad6e24f26ac24 (diff) | |
download | clang-b14b766b1c2e712e1b2ccca1418fb0fbb68d0230.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/DiagnosticGroups.td')
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index c0128f56a5..25c12445f7 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -620,7 +620,8 @@ def DeallocInCategory:DiagGroup<"dealloc-in-category">; def SelectorTypeMismatch : DiagGroup<"selector-type-mismatch">; def Selector : DiagGroup<"selector", [SelectorTypeMismatch]>; def Protocol : DiagGroup<"protocol">; -def AtProtocol : DiagGroup<"at-protocol">; +// No longer in use, preserve for backwards compatibility. +def : DiagGroup<"at-protocol">; def PropertyAccessDotSyntax: DiagGroup<"property-access-dot-syntax">; def PropertyAttr : DiagGroup<"property-attribute-mismatch">; def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">; |