mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-30 17:21:10 +00:00
Issue the 2nd fixit even if fix-it hint is supressed.
// rdar://9091893 llvm-svn: 129481
This commit is contained in:
parent
d0fb04f437
commit
38675543c5
@ -10081,12 +10081,11 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
|
||||
|
||||
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
|
||||
|
@ -10,6 +10,7 @@ void myFunc() {
|
||||
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}}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user