[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
determining whether a RecordDecl is CFError. CFErrorRef used to be declared with "objc_bridge(NSError)" but is now declared with "objc_bridge_mutable(NSError)". Look for either when checking whether a RecordDecl is CFError. rdar://problem/35034779 llvm-svn: 316531
This commit is contained in:
parent
c677268721
commit
bc1d56eafa
|
@ -3482,13 +3482,20 @@ classifyPointerDeclarator(Sema &S, QualType type, Declarator &declarator,
|
||||||
isCFError = (S.CFError == recordDecl);
|
isCFError = (S.CFError == recordDecl);
|
||||||
} else {
|
} else {
|
||||||
// Check whether this is CFError, which we identify based on its bridge
|
// Check whether this is CFError, which we identify based on its bridge
|
||||||
// to NSError.
|
// to NSError. CFErrorRef used to be declared with "objc_bridge" but is
|
||||||
|
// now declared with "objc_bridge_mutable", so look for either one of
|
||||||
|
// the two attributes.
|
||||||
if (recordDecl->getTagKind() == TTK_Struct && numNormalPointers > 0) {
|
if (recordDecl->getTagKind() == TTK_Struct && numNormalPointers > 0) {
|
||||||
if (auto bridgeAttr = recordDecl->getAttr<ObjCBridgeAttr>()) {
|
IdentifierInfo *bridgedType = nullptr;
|
||||||
if (bridgeAttr->getBridgedType() == S.getNSErrorIdent()) {
|
if (auto bridgeAttr = recordDecl->getAttr<ObjCBridgeAttr>())
|
||||||
S.CFError = recordDecl;
|
bridgedType = bridgeAttr->getBridgedType();
|
||||||
isCFError = true;
|
else if (auto bridgeAttr =
|
||||||
}
|
recordDecl->getAttr<ObjCBridgeMutableAttr>())
|
||||||
|
bridgedType = bridgeAttr->getBridgedType();
|
||||||
|
|
||||||
|
if (bridgedType == S.getNSErrorIdent()) {
|
||||||
|
S.CFError = recordDecl;
|
||||||
|
isCFError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
@class NSError;
|
||||||
|
|
||||||
|
#pragma clang assume_nonnull begin
|
||||||
|
|
||||||
|
#ifdef USE_MUTABLE
|
||||||
|
typedef struct __attribute__((objc_bridge_mutable(NSError))) __CFError * CFErrorRef;
|
||||||
|
#else
|
||||||
|
typedef struct __attribute__((objc_bridge(NSError))) __CFError * CFErrorRef;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void func1(CFErrorRef *error);
|
||||||
|
|
||||||
|
#pragma clang assume_nonnull end
|
|
@ -0,0 +1,5 @@
|
||||||
|
// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs -x objective-c -Wnullability-completeness -Werror -verify %s
|
||||||
|
// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs -x objective-c -Wnullability-completeness -Werror -verify -DUSE_MUTABLE %s
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
#include "nullability-completeness-cferror.h"
|
Loading…
Reference in New Issue