summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-30 10:53:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-06-30 10:53:14 +0000
commit639ffb0c073255979f337a9c47cabfd32e54251b (patch)
treee581004721720d79fb1f5f0a279a5632af50ed59 /clang/lib/Sema
parent743b3fd196e027fadb4ea890cd2289e63bcfd5f5 (diff)
downloadbcm5719-llvm-639ffb0c073255979f337a9c47cabfd32e54251b.tar.gz
bcm5719-llvm-639ffb0c073255979f337a9c47cabfd32e54251b.zip
Fix rdar://8139785 "implement warning on dead expression in comma operator"
As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g: x || test_logical_foo1(); emitted a bogus "expression result unused" for 'x'. llvm-svn: 107274
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ae16d57870f..c6d5c6590d8 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5875,6 +5875,8 @@ QualType Sema::CheckAssignmentOperands(Expr *LHS, Expr *&RHS,
// C99 6.5.17
QualType Sema::CheckCommaOperands(Expr *LHS, Expr *&RHS, SourceLocation Loc) {
+ DiagnoseUnusedExprResult(LHS);
+
// Comma performs lvalue conversion (C99 6.3.2.1), but not unary conversions.
// C++ does not perform this conversion (C++ [expr.comma]p1).
if (!getLangOptions().CPlusPlus)
OpenPOWER on IntegriCloud