summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-01-04 16:58:14 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-01-04 16:58:14 +0000
commitfb6deeb984d6d1dd16938c41a662bdafc969b745 (patch)
treeb22b6b1562daaf1890eadb5f41f633f578bc0f0b /clang/lib/Sema/SemaExpr.cpp
parentc2054144eec0d6ee9826a3ba7439bab219872c84 (diff)
downloadbcm5719-llvm-fb6deeb984d6d1dd16938c41a662bdafc969b745.tar.gz
bcm5719-llvm-fb6deeb984d6d1dd16938c41a662bdafc969b745.zip
Refactor the way we handle diagnosing unused expression results.
Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. llvm-svn: 350404
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f8b991b7c74..aa4b23b15c5 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4736,8 +4736,9 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD,
if (Result.isInvalid())
return true;
- Result = ActOnFinishFullExpr(Result.getAs<Expr>(),
- Param->getOuterLocStart());
+ Result =
+ ActOnFinishFullExpr(Result.getAs<Expr>(), Param->getOuterLocStart(),
+ /*DiscardedValue*/ false);
if (Result.isInvalid())
return true;
OpenPOWER on IntegriCloud