Misc. cleanups suggested by Aaron Ballman

llvm-svn: 240297
This commit is contained in:
Douglas Gregor
2015-06-22 17:19:03 +00:00
parent 1a3ae83722
commit 83e32984ae
2 changed files with 13 additions and 7 deletions

View 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),

View 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) {