]> granicus.if.org Git - clang/commitdiff
Misc. cleanups suggested by Aaron Ballman
authorDouglas Gregor <dgregor@apple.com>
Mon, 22 Jun 2015 17:19:03 +0000 (17:19 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 22 Jun 2015 17:19:03 +0000 (17:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240297 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
lib/Sema/SemaType.cpp

index 2e62ea66a5f8c61cbc3dd340c5b21f930bc829b1..cb1be8d505360f67ebbfb9c181f1abb6308b36f5 100644 (file)
@@ -2480,8 +2480,7 @@ static void mergeParamDeclTypes(ParmVarDecl *NewParam,
           << ((OldParam->getObjCDeclQualifier() & Decl::OBJC_TQ_CSNullability) != 0);
         S.Diag(OldParam->getLocation(), diag::note_previous_declaration);
       }
-    }
-    else {
+    } else {
       QualType NewT = NewParam->getType();
       NewT = S.Context.getAttributedType(
                          AttributedType::getNullabilityAttrKind(*Oldnullability),
index 88633d21ac41b209ae2fb92c8a2b3c70628cc037..aac0862c09a0a22b64316d0f2fd7b09467676757 100644 (file)
@@ -5202,16 +5202,23 @@ static bool distributeNullabilityTypeAttr(TypeProcessingState &state,
 
     // Complain about the nullability qualifier being in the wrong
     // place.
-    unsigned pointerKind
-      = chunk.Kind == DeclaratorChunk::Pointer ? (inFunction ? 3 : 0)
-        : chunk.Kind == DeclaratorChunk::BlockPointer ? 1
-        : inFunction? 4 : 2;
+    enum {
+      PK_Pointer,
+      PK_BlockPointer,
+      PK_MemberPointer,
+      PK_FunctionPointer,
+      PK_MemberFunctionPointer,
+    } pointerKind
+      = chunk.Kind == DeclaratorChunk::Pointer ? (inFunction ? PK_FunctionPointer
+                                                             : PK_Pointer)
+        : chunk.Kind == DeclaratorChunk::BlockPointer ? PK_BlockPointer
+        : inFunction? PK_MemberFunctionPointer : PK_MemberPointer;
 
     auto diag = state.getSema().Diag(attr.getLoc(),
                                      diag::warn_nullability_declspec)
       << static_cast<unsigned>(mapNullabilityAttrKind(attr.getKind()))
       << type
-      << pointerKind;
+      << static_cast<unsigned>(pointerKind);
 
     // FIXME: MemberPointer chunks don't carry the location of the *.
     if (chunk.Kind != DeclaratorChunk::MemberPointer) {