[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 00:33:20 PDT 2024


================
@@ -2007,6 +2022,21 @@ class CXXDeductionGuideDecl : public FunctionDecl {
   /// this is an implicit deduction guide.
   CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; }
 
+  /// Get the deduction guide from which this deduction guide was generated,
+  /// if it was generated as part of alias template deduction or from an
+  /// inherited constructor.
+  CXXDeductionGuideDecl *getSourceDeductionGuide() const {
+    return SourceDeductionGuide.getPointer();
+  }
+
+  void setSourceDeductionGuide(CXXDeductionGuideDecl *DG) {
+    SourceDeductionGuide.setPointer(DG);
+  }
+
+  SourceKind getSourceKind() const { return SourceDeductionGuide.getInt(); }
----------------
antangelo wrote:

I've opted for adding an additional kind `None` for this case, I think it makes the code cleaner by not having `Alias` serve as the default and needing to check the pointer before being able to read the kind.

https://github.com/llvm/llvm-project/pull/98788


More information about the cfe-commits mailing list