summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 3d2b14933e2..ac1128b361d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -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
OpenPOWER on IntegriCloud