SourceLocation Open = E->getSourceRange().getBegin();
SourceLocation Close = E->getSourceRange().getEnd();
- if (!Open.isMacroID() && !Close.isMacroID()) {
- SourceLocation LocForEndOfToken = PP.getLocForEndOfToken(Close);
- Diag(Loc, diag::note_condition_assign_silence)
- << FixItHint::CreateInsertion(Open, "(")
- << FixItHint::CreateInsertion(LocForEndOfToken, ")");
- }
+ SourceLocation LocForEndOfToken =
+ Close.isMacroID() ? Close : PP.getLocForEndOfToken(Close);
+ Diag(Loc, diag::note_condition_assign_silence)
+ << FixItHint::CreateInsertion(Open, "(")
+ << FixItHint::CreateInsertion(LocForEndOfToken, ")");
}
/// \brief Redundant parentheses over an equality comparison can indicate
int value;
while (value = va_arg(values, int)) { // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note {{use '==' to turn this assignment into an equality comparison}}
+ // expected-note {{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note {{place parentheses around the assignment to silence this warning}}
}
}