summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-06-19 18:27:52 +0000
committerDouglas Gregor <dgregor@apple.com>2015-06-19 18:27:52 +0000
commit86b4268153c9e903065f23f533b67393a39f9503 (patch)
treedfed20d71f573ada1a686a3b244ddaa06ff13264 /clang/lib/AST/DeclPrinter.cpp
parentbec595a6412104306926278f811fd7a75fd0d25f (diff)
downloadbcm5719-llvm-86b4268153c9e903065f23f533b67393a39f9503.tar.gz
bcm5719-llvm-86b4268153c9e903065f23f533b67393a39f9503.zip
Code completion for nullability type specifiers.
Another part of rdar://problem/18868820. llvm-svn: 240159
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index d6c03169d9c..c3ce4760097 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -937,18 +937,6 @@ void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
// Objective-C declarations
//----------------------------------------------------------------------------
-/// Strip off the top-level nullability annotation, if it's there.
-static Optional<NullabilityKind> stripOuterNullability(QualType &T) {
- if (auto attributed = dyn_cast<AttributedType>(T.getTypePtr())) {
- if (auto nullability = attributed->getImmediateNullability()) {
- T = attributed->getModifiedType();
- return nullability;
- }
- }
-
- return None;
- }
-
void DeclPrinter::PrintObjCMethodType(ASTContext &Ctx,
Decl::ObjCDeclQualifier Quals,
QualType T) {
@@ -966,7 +954,7 @@ void DeclPrinter::PrintObjCMethodType(ASTContext &Ctx,
if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Oneway)
Out << "oneway ";
if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_CSNullability) {
- if (auto nullability = stripOuterNullability(T)) {
+ if (auto nullability = AttributedType::stripOuterNullability(T)) {
Out << getNullabilitySpelling(*nullability).substr(2) << ' ';
}
}
@@ -1212,7 +1200,7 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
if (PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_nullability) {
- if (auto nullability = stripOuterNullability(T)) {
+ if (auto nullability = AttributedType::stripOuterNullability(T)) {
if (*nullability == NullabilityKind::Unspecified &&
(PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_null_resettable)) {
OpenPOWER on IntegriCloud