Skip to content

Conversation

@vitalybuka
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

Changes

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

2 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_fake_stack.cpp (+2-2)
  • (modified) compiler-rt/lib/asan/asan_fake_stack.h (-1)
diff --git a/compiler-rt/lib/asan/asan_fake_stack.cpp b/compiler-rt/lib/asan/asan_fake_stack.cpp
index f2f6769520ae8..5034ea2a0e459 100644
--- a/compiler-rt/lib/asan/asan_fake_stack.cpp
+++ b/compiler-rt/lib/asan/asan_fake_stack.cpp
@@ -216,10 +216,10 @@ void FakeStack::ForEachFakeFrame(RangeIteratorCallback callback, void* arg) {
 #if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA
 static THREADLOCAL FakeStack* fake_stack_tls;
 
-FakeStack* GetTLSFakeStack() { return fake_stack_tls; }
+static FakeStack* GetTLSFakeStack() { return fake_stack_tls; }
 void SetTLSFakeStack(FakeStack* fs) { fake_stack_tls = fs; }
 #else
-FakeStack* GetTLSFakeStack() { return 0; }
+static FakeStack* GetTLSFakeStack() { return nullptr; }
 void SetTLSFakeStack(FakeStack* fs) {}
 #endif  // (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA
 
diff --git a/compiler-rt/lib/asan/asan_fake_stack.h b/compiler-rt/lib/asan/asan_fake_stack.h
index 50706e6e5876c..ec772c3299f00 100644
--- a/compiler-rt/lib/asan/asan_fake_stack.h
+++ b/compiler-rt/lib/asan/asan_fake_stack.h
@@ -195,7 +195,6 @@ class FakeStack {
   void *true_start;
 };
 
-FakeStack *GetTLSFakeStack();
 void SetTLSFakeStack(FakeStack *fs);
 
 }  // namespace __asan

@vitalybuka vitalybuka requested a review from Copilot October 16, 2025 00:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR makes the GetTLSFakeStack function static to restrict its scope to the current translation unit. It removes the function declaration from the header file and adds the static keyword to both implementations in the source file.

  • Makes GetTLSFakeStack function static by removing its public declaration
  • Updates both conditional implementations to use static linkage
  • Modernizes return value from 0 to nullptr in the non-Linux implementation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
compiler-rt/lib/asan/asan_fake_stack.h Removes public declaration of GetTLSFakeStack function
compiler-rt/lib/asan/asan_fake_stack.cpp Adds static keyword to both implementations and modernizes null return

Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.nfcasan-make-gettlsfakestack-static to main October 16, 2025 00:59
@vitalybuka vitalybuka merged commit 1c7ae89 into main Oct 16, 2025
9 of 13 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcasan-make-gettlsfakestack-static branch October 16, 2025 00:59
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 16, 2025
Reviewers: fmayer, thurstond

Reviewed By: fmayer

Pull Request: llvm/llvm-project#163669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants