[PATCH] D121715: [Clang] Fix an unused-but-set-variable warning with volatile variable
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 21 11:24:46 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:7925
DeclRefExpr *LHS = nullptr;
+ bool IsComponentAssign = false;
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
----------------
================
Comment at: clang/test/Sema/warn-unused-but-set-variables.c:35
+ // volatile variable k is used, no warning.
+ volatile int k = 0;
+ for (int i = 0; i < 1000; i++)
----------------
I'd like to see another test:
```
typedef volatile int volint;
volint l = 0;
l += 1; // no warning
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121715/new/
https://reviews.llvm.org/D121715
More information about the cfe-commits
mailing list