-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[NFC][Asan] Make GetTLSFakeStack static #163669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC][Asan] Make GetTLSFakeStack static #163669
Conversation
Created using spr 1.3.6
Created using spr 1.3.6 [skip ci]
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) ChangesFull diff: https://github.com/llvm/llvm-project/pull/163669.diff 2 Files Affected:
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
|
There was a problem hiding this 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
GetTLSFakeStackfunction static by removing its public declaration - Updates both conditional implementations to use
staticlinkage - Modernizes return value from
0tonullptrin 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 |
Reviewers: fmayer, thurstond Reviewed By: fmayer Pull Request: llvm/llvm-project#163669
No description provided.