diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-13 20:31:26 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-04-13 20:31:26 +0000 |
commit | 81ab3cfcf2f312e82c51e58a1fce8e85e9fe59c3 (patch) | |
tree | 71eea3f21ed1a66c933d4793048aa9694deb91d3 /lib/Sema/SemaExpr.cpp | |
parent | 9b064d8bf94fc70aee7773feb04e5e96134f52f2 (diff) |
No fixit hint for builtin expressions which are
defined in a macro. // rdar://9091893
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 96b2e56b41..3d2b14933e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -10070,9 +10070,6 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { return; } - SourceLocation Open = E->getSourceRange().getBegin(); - SourceLocation Close = PP.getLocForEndOfToken(E->getSourceRange().getEnd()); - Diag(Loc, diagnostic) << E->getSourceRange(); if (IsOrAssign) @@ -10082,9 +10079,14 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { Diag(Loc, diag::note_condition_assign_to_comparison) << FixItHint::CreateReplacement(Loc, "=="); - Diag(Loc, diag::note_condition_assign_silence) - << FixItHint::CreateInsertion(Open, "(") - << FixItHint::CreateInsertion(Close, ")"); + 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, ")"); + } } /// \brief Redundant parentheses over an equality comparison can indicate |