[llvm] [Support] Extend ExtensibleRTTI utility to support basic multiple inheritance. (PR #112643)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 18:28:30 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 90767bc41bd69fb4b9ac01a8420ef58bbbaeab7c 0953277f443fdfbefae8cf636c4593747d4905b6 --extensions cpp,h -- llvm/include/llvm/Support/ExtensibleRTTI.h llvm/unittests/Support/ExtensibleRTTITest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Support/ExtensibleRTTI.h b/llvm/include/llvm/Support/ExtensibleRTTI.h
index 6b8f5efd6b..a0b700891a 100644
--- a/llvm/include/llvm/Support/ExtensibleRTTI.h
+++ b/llvm/include/llvm/Support/ExtensibleRTTI.h
@@ -117,19 +117,18 @@ public:
   const void *dynamicClassID() const override { return &ThisT::ID; }
 
   /// Check whether this instance is a subclass of QueryT.
-  template <typename QueryT>
-  bool isA() const { return isA(QueryT::classID()); }
+  template <typename QueryT> bool isA() const { return isA(QueryT::classID()); }
 
   bool isA(const void *const ClassID) const override {
     return ClassID == classID() || parentsAreA<ParentTs...>(ClassID);
   }
 
-  template <typename T>
-  static bool classof(const T *R) { return R->template isA<ThisT>(); }
-private:
+  template <typename T> static bool classof(const T *R) {
+    return R->template isA<ThisT>();
+  }
 
-  template <typename T>
-  bool parentsAreA(const void *const ClassID) const {
+private:
+  template <typename T> bool parentsAreA(const void *const ClassID) const {
     return T::isA(ClassID);
   }
 
diff --git a/llvm/unittests/Support/ExtensibleRTTITest.cpp b/llvm/unittests/Support/ExtensibleRTTITest.cpp
index 4d78106690..08fc6a43d8 100644
--- a/llvm/unittests/Support/ExtensibleRTTITest.cpp
+++ b/llvm/unittests/Support/ExtensibleRTTITest.cpp
@@ -37,8 +37,8 @@ public:
 };
 
 class MyMultipleInheritanceType
-  : public RTTIExtends<MyMultipleInheritanceType,
-                       MyDerivedType, MyOtherDerivedType> {
+    : public RTTIExtends<MyMultipleInheritanceType, MyDerivedType,
+                         MyOtherDerivedType> {
 public:
   static char ID;
 };

``````````

</details>


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


More information about the llvm-commits mailing list