[PATCH] D101835: [llvm] llvm-tapi-diff

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 19:48:01 PDT 2021


jyknight added inline comments.


================
Comment at: llvm/tools/llvm-tapi-diff/DiffEngine.h:57
+  /// from each file where a diff is present.
+  std::vector<std::unique_ptr<AttributeDiff>> Values;
+  DiffOutput(std::string Name) : Name(Name){};
----------------
>  std::vector<std::unique_ptr<AttributeDiff>>

Storing a subclass of AttributeDiff into a unique_ptr<AttributeDiff> is not OK, because AttributeDiff does not have a virtual destructor. So, this tool is invoking UB.

Just adding the virtual destructor to AttributeDiff is probably ok -- there doesn't seem to be any reason to avoid using virtual dispatch in this tool's class hierarchy, afaict.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101835



More information about the llvm-commits mailing list