[llvm] [LLVM][Support] Add getTrailingObjects() for single trailing type (PR #138970)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 10:19:07 PDT 2025


================
@@ -14,19 +14,19 @@
 using namespace llvm;
 
 namespace {
-// This class, beyond being used by the test case, a nice
-// demonstration of the intended usage of TrailingObjects, with a
-// single trailing array.
-class Class1 final : protected TrailingObjects<Class1, short> {
+// This class, beyond being used by the test case, a nice demonstration of the
+// intended usage of TrailingObjects, with a single trailing array.
+class Class1 final : private TrailingObjects<Class1, short> {
----------------
jurahul wrote:

The comment in TrailingObjects.h says:

```
/// All the methods implemented by this class are intended for use
/// by the implementation of the class, not as part of its interface
/// (thus, private inheritance is suggested).
```

Hence making this private as the test case should also demonstrate the recommended usage of this class.

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


More information about the llvm-commits mailing list