summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-06-19 18:14:46 +0000
committerDouglas Gregor <dgregor@apple.com>2015-06-19 18:14:46 +0000
commit849ebc269fe17def169c812f929746cb98955664 (patch)
tree5866b34d318c220f0fb7b078164e0710e72f7ea8 /clang/lib/AST/DeclPrinter.cpp
parent813a066f16df52783708fdc2ef708bb76a9ff521 (diff)
downloadbcm5719-llvm-849ebc269fe17def169c812f929746cb98955664.tar.gz
bcm5719-llvm-849ebc269fe17def169c812f929746cb98955664.zip
Implement the 'null_resettable' attribute for Objective-C properties.
'null_resettable' properties are those whose getters return nonnull but whose setters take nil, to "reset" the property to some default. Implements rdar://problem/19051334. llvm-svn: 240155
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 609cc08545a..d6c03169d9c 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -1213,8 +1213,14 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
if (PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_nullability) {
if (auto nullability = stripOuterNullability(T)) {
- Out << (first ? ' ' : ',')
- << getNullabilitySpelling(*nullability).substr(2);
+ if (*nullability == NullabilityKind::Unspecified &&
+ (PDecl->getPropertyAttributes() &
+ ObjCPropertyDecl::OBJC_PR_null_resettable)) {
+ Out << (first ? ' ' : ',') << "null_resettable";
+ } else {
+ Out << (first ? ' ' : ',')
+ << getNullabilitySpelling(*nullability).substr(2);
+ }
first = false;
}
}
OpenPOWER on IntegriCloud