summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-04-13 20:31:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-04-13 20:31:26 +0000
commite72509c10cf67975ddd290034a84ef97ec6f0b8d (patch)
tree7bd821c03abdf6a0ef70f4a03189f9b8a9b6a174 /clang/lib
parenta865185ad6489e938ca18409bdcaf795616b3382 (diff)
downloadbcm5719-llvm-e72509c10cf67975ddd290034a84ef97ec6f0b8d.tar.gz
bcm5719-llvm-e72509c10cf67975ddd290034a84ef97ec6f0b8d.zip
No fixit hint for builtin expressions which are
defined in a macro. // rdar://9091893 llvm-svn: 129465
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 96b2e56b415..3d2b14933e2 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud