[PATCH] D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 5 08:53:27 PDT 2021
JonasToth added a comment.
In D54943#2956218 <https://reviews.llvm.org/D54943#2956218>, @tiagoma wrote:
> I am getting false positives with
>
> struct S{};
>
> void f(__unaligned S*);
>
> void scope()
> {
> S s;
> f(&s);
> }
This godbolt link has the AST for the example.
https://godbolt.org/z/8EvsM3Eqe
The `ExprMutAnalyzer` ignores 'NoOp' casts as modifications, because in our testing the 'adding const' to an argument was a NoOp-cast. In this case, this is a NoOp-Cast, too, but not adding const.
This shadows marking the pointer as mutated and results in the false positive.
I would leave this out of this patch, but make a separate fix. Other forms of NoOp-casting are affected too.
https://bugs.llvm.org/show_bug.cgi?id=51756
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54943/new/
https://reviews.llvm.org/D54943
More information about the cfe-commits
mailing list