[PATCH] D154581: [clang][Interp] Track existing InitMaps in InterpState

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 10:06:04 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:328-330
+InitMap::T *InitMap::data() { return Data.get(); }
 
+const InitMap::T *InitMap::data() const { return Data.get(); }
----------------
Inline these into the header now?

Even though these are private methods, I'm a bit worried about handing out a naked pointer that comes from a `unique_ptr` as that's pretty easy to run into lifetime issues with, but I think it's okay as-is (I don't have a vastly better approach.)


================
Comment at: clang/lib/AST/Interp/Descriptor.h:207
   /// Initializes the map with no fields set.
   InitMap(unsigned N);
 
----------------
Now that this is public, can we make it `explicit` so we don't get accidental conversions from `unsigned`?


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

https://reviews.llvm.org/D154581



More information about the cfe-commits mailing list