summaryrefslogtreecommitdiff
path: root/include/clang/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-10-09 02:04:54 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-10-09 02:04:54 +0000
commitd2d3fbf13186aa57a70b726b300cb4ea2c2bcb89 (patch)
tree2e412aa3acfd6f3f53f71defb34e38a4fa81cdc8 /include/clang/Sema
parent254170520fef51111331fb5a22c75ebfef881483 (diff)
downloadclang-d2d3fbf13186aa57a70b726b300cb4ea2c2bcb89.tar.gz
[c++20] P1152R4: warn on any simple-assignment to a volatile lvalue
whose value is not ignored. We don't warn on all the cases that are deprecated: specifically, we choose to not warn for now if there are parentheses around the assignment but its value is not actually used. This seems like a more defensible rule, particularly for cases like sizeof(v = a), where the parens are part of the operand rather than the sizeof syntax. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema')
-rw-r--r--include/clang/Sema/Sema.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index d5d91e31f5..c9211eb700 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1062,6 +1062,11 @@ public:
llvm::SmallPtrSet<const Expr *, 8> PossibleDerefs;
+ /// Expressions appearing as the LHS of a volatile assignment in this
+ /// context. We produce a warning for these when popping the context if
+ /// they are not discarded-value expressions nor unevaluated operands.
+ SmallVector<Expr*, 2> VolatileAssignmentLHSs;
+
/// \brief Describes whether we are in an expression constext which we have
/// to handle differently.
enum ExpressionKind {
@@ -4248,6 +4253,9 @@ public:
ExprResult TransformToPotentiallyEvaluated(Expr *E);
ExprResult HandleExprEvaluationContextForTypeof(Expr *E);
+ ExprResult CheckUnevaluatedOperand(Expr *E);
+ void CheckUnusedVolatileAssignment(Expr *E);
+
ExprResult ActOnConstantExpression(ExprResult Res);
// Functions for marking a declaration referenced. These functions also