[clang] [RecursiveASTVisitor] Do not inline TraverseStmt (NFC) (PR #107601)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 08:55:23 PDT 2024


https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/107601

>From f16539428465d61c9017c0f7686d9632913aa853 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Fri, 6 Sep 2024 17:45:14 +0200
Subject: [PATCH] [RecursiveASTVisitor] Do not inline TraverseStmt (NFC)

---
 clang/include/clang/AST/RecursiveASTVisitor.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 3389670a2ab9d9..cd9947f7ab9805 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -652,9 +652,11 @@ bool RecursiveASTVisitor<Derived>::PostVisitStmt(Stmt *S) {
 
 #undef DISPATCH_STMT
 
+// Inlining this method can lead to large code size and compile-time increases
+// without any benefit to runtime performance.
 template <typename Derived>
-bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S,
-                                                DataRecursionQueue *Queue) {
+LLVM_ATTRIBUTE_NOINLINE bool
+RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S, DataRecursionQueue *Queue) {
   if (!S)
     return true;
 



More information about the cfe-commits mailing list