[PATCH] D129097: [clang][dataflow] Handle null pointers of type std::nullptr_t

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 5 05:48:01 PDT 2022


gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp:61
+  auto CanonicalPointeeType =
+      PointeeType.isNull() ? PointeeType : PointeeType.getCanonicalType();
   auto Res = NullPointerVals.try_emplace(CanonicalPointeeType, nullptr);
----------------
Could you add a comment to the header that a caller may pass a null PointeeType as a "pointee" of a nullptr_t?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:2216-2226
     struct Baz {};
     void target() {
       int *FooX = nullptr;
       int *FooY = nullptr;
       bool **Bar = nullptr;
       Baz *Baz = nullptr;
+      // Use decltype to avoid needing to include <cstddef>. This generates an
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129097



More information about the cfe-commits mailing list