[PATCH] D138275: [clang][Interp] Avoid leaking init maps of local primitive arrays

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 12:17:32 PST 2023


aaron.ballman added a comment.

Generally LGTM though I had a suggestion that might help some of Erich's concerns. FWIW, I share his concerns about memory ownership in the interpreter becoming convoluted



================
Comment at: clang/lib/AST/Interp/InterpFrame.h:51-53
+  /// InterpFrame destructor to avoid memory leaks in case the
+  /// interpretation was not successful.
+  void destroyAll();
----------------
Rather than allow anyone with access to the function to call it, would it make sense to put the functionality directly in the destructor? It's not a huge amount of code, and it reduces the cognitive overhead of figuring out who can destroy what.


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

https://reviews.llvm.org/D138275



More information about the cfe-commits mailing list