diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-28 18:25:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-28 18:25:28 +0000 |
commit | 2706a550711dd4c85924b78cc1787267e62aec56 (patch) | |
tree | 060f267010b2d3c3c0fdc4aceae3170eb8af904f /clang/lib | |
parent | 1d0f16f22aa46c7cd6ef016fab408bec3990849c (diff) | |
download | bcm5719-llvm-2706a550711dd4c85924b78cc1787267e62aec56.tar.gz bcm5719-llvm-2706a550711dd4c85924b78cc1787267e62aec56.zip |
fix PR4633: cast to void should silence the 'unused expression' warning.
llvm-svn: 77344
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 2c473ebc428..79ebb546d07 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -593,11 +593,10 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, return true; } case CStyleCastExprClass: - // If this is a cast to void, check the operand. Otherwise, the result of - // the cast is unused. + // If this is an explicit cast to void, allow it. People do this when they + // think they know what they're doing :). if (getType()->isVoidType()) - return cast<CastExpr>(this)->getSubExpr() - ->isUnusedResultAWarning(Loc, R1, R2); + return false; Loc = cast<CStyleCastExpr>(this)->getLParenLoc(); R1 = cast<CStyleCastExpr>(this)->getSubExpr()->getSourceRange(); return true; |