[compiler-rt] [scudo] Move getPageSize() decl to common.h header (PR #157146)

Roland McGrath via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 10:23:51 PDT 2025


https://github.com/frobtech created https://github.com/llvm/llvm-project/pull/157146

The getPageSize() function is defined in the platform-specific
source files but used in common.cpp.  Every function used across
files should be declared in a header so the same declaration is
in scope for the callers and the definition.


>From aaac07ff8937c1b9ae3f24b1e07bb9a3afba6457 Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Fri, 5 Sep 2025 10:20:16 -0700
Subject: [PATCH] [scudo] Move getPageSize() decl to common.h header

The getPageSize() function is defined in the platform-specific
source files but used in common.cpp.  Every function used across
files should be declared in a header so the same declaration is
in scope for the callers and the definition.
---
 compiler-rt/lib/scudo/standalone/common.cpp | 3 ---
 compiler-rt/lib/scudo/standalone/common.h   | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/lib/scudo/standalone/common.cpp b/compiler-rt/lib/scudo/standalone/common.cpp
index 80134c39e757d..f7c1b420f4c77 100644
--- a/compiler-rt/lib/scudo/standalone/common.cpp
+++ b/compiler-rt/lib/scudo/standalone/common.cpp
@@ -16,9 +16,6 @@ namespace scudo {
 uptr PageSizeCached = 0;
 uptr PageSizeLogCached = 0;
 
-// Must be defined in platform specific code.
-uptr getPageSize();
-
 // This must be called in the init path or there could be a race if multiple
 // threads try to set the cached values.
 uptr getPageSizeSlow() {
diff --git a/compiler-rt/lib/scudo/standalone/common.h b/compiler-rt/lib/scudo/standalone/common.h
index e5dfda2e9072a..8adcebd55698d 100644
--- a/compiler-rt/lib/scudo/standalone/common.h
+++ b/compiler-rt/lib/scudo/standalone/common.h
@@ -148,6 +148,10 @@ inline constexpr uptr getPageSizeLogCached() {
 extern uptr PageSizeCached;
 extern uptr PageSizeLogCached;
 
+// Must be defined in platform specific code.
+uptr getPageSize();
+
+// Always calls getPageSize(), but caches the results for get*Cached(), below.
 uptr getPageSizeSlow();
 
 inline uptr getPageSizeCached() {



More information about the llvm-commits mailing list