steakhal added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp:159
+// Note: This pointer has type 'const MemRegion *'
+REGISTER_TRAIT_WITH_PROGRAMSTATE(EnvPtrRegion, const void *)
+
----------------
martong wrote:
> Why is it `const void *`? Why can't we use `const MemRegion *` and get rid of 
> the ugly reinterpret_cast?  There must be a reason ,which I'd like to see 
> documented in the comments. 
The trait is only specialized to `const void*` and `void*` see here:

https://github.com/llvm/llvm-project/blob/main/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h#L298-L323

```lang=C++
template <> struct ProgramStatePartialTrait<void *>
template <> struct ProgramStatePartialTrait<const void *>
```

I'm not exactly sure why don't we specialize to //any// pointer type of type 
`T`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97699/new/

https://reviews.llvm.org/D97699

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to