JonasToth added inline comments.
================
Comment at: clang-tidy/utils/ExprMutationAnalyzer.cpp:88
+
+const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) {
+ // LHS of any assignment operators.
----------------
shuaiwang wrote:
> aaron.ballman wrote:
> > Should this also consider a DeclRefExpr to a volatile-qualified variable as
> > a direct mutation?
> >
> > What about using `Expr::HasSideEffect()`?
> Good catch about DeclRefExpr to volatile.
>
> `HasSideEffects` means something different. Here find*Mutation means find a
> Stmt **in ancestors** that mutates the given Expr. `HasSideEffects` IIUC
> means whether anything is mutated by the Expr but doesn't care about what
> exactly is mutated.
May I ask the exact semantics for `volatile`? I would add the test to my check,
too.
It is possible to write `const volatile int m = 42;`, but if i understand
correctly `m` could still change by hardware, or would this be UB?
If the `const` is missing, one must always assume external modification, right?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D45679
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits