From: Douglas Gregor Date: Mon, 22 Jun 2015 17:19:03 +0000 (+0000) Subject: Misc. cleanups suggested by Aaron Ballman X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51ef4b95aad99852e704dea9c172f72df4ecb5d1;p=clang Misc. cleanups suggested by Aaron Ballman git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240297 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 2e62ea66a5..cb1be8d505 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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), diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 88633d21ac..aac0862c09 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -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(mapNullabilityAttrKind(attr.getKind())) << type - << pointerKind; + << static_cast(pointerKind); // FIXME: MemberPointer chunks don't carry the location of the *. if (chunk.Kind != DeclaratorChunk::MemberPointer) {