diff options
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 17 |
2 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 2e62ea66a5f..cb1be8d5053 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 88633d21ac4..aac0862c09a 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/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<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) { |

