summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2011-09-19 18:51:20 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2011-09-19 18:51:20 +0000
commitdcaacaa190cd909ea63301e33224bd4553575052 (patch)
tree3eb7bb6c8833bf30ff0cfc74d85a725caf345a39 /clang/lib/AST
parent40700e0992cd565ad07d5c193dbc377f379dec46 (diff)
downloadbcm5719-llvm-dcaacaa190cd909ea63301e33224bd4553575052.tar.gz
bcm5719-llvm-dcaacaa190cd909ea63301e33224bd4553575052.zip
Fix a QoI bug with overloaded operators inside macros.
We were failing to set source locations and ranges in isUnusedResultAWarning for CXXOperatorCallExprs, leading to an "expression result unused" warning with absolutely no context if the expression was inside a macro. llvm-svn: 140036
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Expr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 8beecc0856c..7983d61f041 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1631,8 +1631,11 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
// DiagnoseUnusedComparison should be as well.
const CXXOperatorCallExpr *Op = cast<CXXOperatorCallExpr>(this);
if (Op->getOperator() == OO_EqualEqual ||
- Op->getOperator() == OO_ExclaimEqual)
+ Op->getOperator() == OO_ExclaimEqual) {
+ Loc = Op->getOperatorLoc();
+ R1 = Op->getSourceRange();
return true;
+ }
// Fallthrough for generic call handling.
}
OpenPOWER on IntegriCloud