[llvm-dev] DenseMap/ValueMap: is M[New]=M[Old] valid ?

Jeroen Dobbelaere via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 27 02:46:03 PDT 2019


> From: Martin Storsjö <martin at martin.st>
[...]
> It's not a question about when the operands are evaluated - both do
> evaluate them in the same order. But evaluating the left and right hand
> side leaves you with two references. Then to do the assignment, you
> dereference the right hand side reference and assign it to the
> dereferenced left hand side reference.
[...]
>          GlobalMap[a] = GlobalMap[b];
[...]

Is there a checker in clang that can detect this kind of wrong usage ?
If not, how hard would it be to write one ?

Greetings,

Jeroen Dobbelaere



More information about the llvm-dev mailing list