[PATCH] D135557: Add needsImplicitDefaultConstructor and friends

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 10:19:16 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/bindings/python/clang/cindex.py:1512-1514
+    def record_defaulted_copy_constructor_is_deleted(self):
+        """Returns True if the cursor refers to a C++ record declaration
+        that has its default copy constructor deleted.
----------------
We might want to document that this API may return different results while the record is being formed from after the record is complete. e.g., we may say the defaulted copy constructor is not deleted at the start of the record but later find a data member that causes us to delete the defaulted copy constructor. (Similar for the others.)


================
Comment at: clang/bindings/python/clang/cindex.py:1530
+
+    def record_needs_implicit_default_constructor(self):
+        """Returns True if the cursor refers to a C++ record declaration
----------------
I don't think we should expose any of the "needs" functions like this -- those are internal implementation details of the class and I don't think we want to calcify that into something we have to support forever. As we add members to a class, we recalculate whether the added member causes us to delete defaulted special members (among other things), and the "needs" functions are basically used when the class is completed to handle lazily created special members. I'm pretty sure that lazy creation is not mandated by the standard, which is why I think the "needs" functions are more of an implementation detail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135557



More information about the cfe-commits mailing list