================
@@ -187,80 +187,124 @@ Value *lowerObjectSizeCall(
     const TargetLibraryInfo *TLI, AAResults *AA, bool MustSucceed,
     SmallVectorImpl<Instruction *> *InsertedInstructions = nullptr);
 
-using SizeOffsetType = std::pair<APInt, APInt>;
+/// SizeOffsetType - A base template class for the object size visitors. Used
+/// here as a self-documenting way to handle the values rather than using a
+/// \p std::pair.
+template <typename T> struct SizeOffsetType {
+  T Size;
+  T Offset;
+
+  SizeOffsetType() = default;
+  SizeOffsetType(T Size, T Offset) : Size(Size), Offset(Offset) {}
+  virtual ~SizeOffsetType() = default;
+
+  virtual bool knownSize() const = 0;
+  virtual bool knownOffset() const = 0;
----------------
nikic wrote:

Use CRTP instead of virtual dispatch?

Should at least make the child classes final if you're using virtual.

https://github.com/llvm/llvm-project/pull/76882
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to