[clang] [NFC][Clang] Adopt simplified `getTrailingObjects` in StmtObjC (PR #143256)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 7 06:32:51 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/143256.diff


1 Files Affected:

- (modified) clang/include/clang/AST/StmtObjC.h (+5-5) 


``````````diff
diff --git a/clang/include/clang/AST/StmtObjC.h b/clang/include/clang/AST/StmtObjC.h
index 03bc61f54cdf5..af95d65fa2a3c 100644
--- a/clang/include/clang/AST/StmtObjC.h
+++ b/clang/include/clang/AST/StmtObjC.h
@@ -166,7 +166,8 @@ class ObjCAtTryStmt final
     : public Stmt,
       private llvm::TrailingObjects<ObjCAtTryStmt, Stmt *> {
   friend TrailingObjects;
-  size_t numTrailingObjects(OverloadToken<Stmt *>) const {
+
+  size_t numTrailingStatements() const {
     return 1 + NumCatchStmts + HasFinally;
   }
 
@@ -185,8 +186,8 @@ class ObjCAtTryStmt final
   /// The order of the statements in memory follows the order in the source,
   /// with the \@try body first, followed by the \@catch statements (if any)
   /// and, finally, the \@finally (if it exists).
-  Stmt **getStmts() { return getTrailingObjects<Stmt *>(); }
-  Stmt *const *getStmts() const { return getTrailingObjects<Stmt *>(); }
+  Stmt **getStmts() { return getTrailingObjects(); }
+  Stmt *const *getStmts() const { return getTrailingObjects(); }
 
   ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
                 Stmt **CatchStmts, unsigned NumCatchStmts,
@@ -262,8 +263,7 @@ class ObjCAtTryStmt final
   }
 
   child_range children() {
-    return child_range(
-        getStmts(), getStmts() + numTrailingObjects(OverloadToken<Stmt *>()));
+    return child_range(getStmts(), getStmts() + numTrailingStatements());
   }
 
   const_child_range children() const {

``````````

</details>


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


More information about the cfe-commits mailing list