diff options
author | Douglas Gregor <dgregor@apple.com> | 2015-10-09 20:36:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2015-10-09 20:36:17 +0000 |
commit | d4f2afa23c8b4a26d553c5e5126351f1d7157f93 (patch) | |
tree | e18aea9cb828c00fc0d29d09f46213183e679138 /clang/lib/Sema/SemaObjCProperty.cpp | |
parent | 6ccc8ca6d9715c76eb89f0d338b2a782f1edd0c4 (diff) | |
download | bcm5719-llvm-d4f2afa23c8b4a26d553c5e5126351f1d7157f93.tar.gz bcm5719-llvm-d4f2afa23c8b4a26d553c5e5126351f1d7157f93.zip |
Fix inference of _Nullable for weak Objective-C properties.
The inference of _Nullable for weak Objective-C properties was broken
in several ways:
* It was back-patching the type information very late in the process
of checking the attributes for an Objective-C property, which is
just wrong.
* It was using ad hoc checks to try to suppress the warning about
missing nullability specifiers (-Wnullability-completeness), which
didn't actual work in all cases (rdar://problem/22985457)
* It was inferring _Nullable even outside of assumes-nonnull regions,
which is wrong.
Putting the inference of _Nullable for weak Objective-C properties in
the same place as all of the other inference logic fixes all of these
ills.
llvm-svn: 249896
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 15843fde39d..374e5ccd918 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -181,7 +181,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, } // Validate the attributes on the @property. - CheckObjCPropertyAttributes(Res, AtLoc, Attributes, + CheckObjCPropertyAttributes(Res, AtLoc, Attributes, (isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCProtocolDecl>(ClassDecl))); @@ -2301,13 +2301,6 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, if (*nullability == NullabilityKind::NonNull) Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "nonnull" << "weak"; - } else { - PropertyTy = - Context.getAttributedType( - AttributedType::getNullabilityAttrKind(NullabilityKind::Nullable), - PropertyTy, PropertyTy); - TypeSourceInfo *TSInfo = PropertyDecl->getTypeSourceInfo(); - PropertyDecl->setType(PropertyTy, TSInfo); } } |