[PATCH] D127105: [analyzer] Fix null pointer deref in CastValueChecker

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 06:10:57 PDT 2022


steakhal added inline comments.


================
Comment at: clang/test/Analysis/cast-value-notes.cpp:311
+public:
+  template <typename> void b() { isa<int>(*this); }
+};
----------------
vabridgers wrote:
> steakhal wrote:
> > This gotta be the `getAs<T>`. Please try to reconstruct the 'feel' of it; like return a `T*` instead of `void` etc.
> I'll attempt a further simplification. This was the product of a very long and tedious manual and creduce reduction process from a 12M preprocessed file :/
What I'm proposing is //concretization//.

Something like this:

```lang=C++
template <typename> struct PointerUnion {
  template <typename T> T* getAs() {
    (void)isa<int>(*this);
    return nullptr;
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127105



More information about the cfe-commits mailing list