summaryrefslogtreecommitdiff
path: root/include/clang/Parse
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
commitbf91d084aea415a34bd7d8fbb2ca5c8c4aa74db9 (patch)
treed245c93daa6e08278c4e72b1769ef9b3d1d4dc1e /include/clang/Parse
parent4e3dd793d75b1710618a091fa8a037c5a75c2525 (diff)
downloadclang-bf91d084aea415a34bd7d8fbb2ca5c8c4aa74db9.tar.gz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350404 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Parse')
-rw-r--r--include/clang/Parse/Parser.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 46e4431913..438ff0e2ed 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -360,6 +360,11 @@ class Parser : public CodeCompletionHandler {
/// just a regular sub-expression.
SourceLocation ExprStatementTokLoc;
+ /// Tests whether an expression value is discarded based on token lookahead.
+ /// It will return true if the lexer is currently processing the })
+ /// terminating a GNU statement expression and false otherwise.
+ bool isExprValueDiscarded();
+
public:
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies);
~Parser() override;