[llvm-branch-commits] [compiler-rt] [llvm] Reentry (PR #135656)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Apr 14 11:29:47 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- compiler-rt/lib/ctx_profile/CtxInstrProfiling.cpp compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp llvm/include/llvm/ProfileData/CtxInstrContextNode.h llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/ctx_profile/CtxInstrProfiling.cpp b/compiler-rt/lib/ctx_profile/CtxInstrProfiling.cpp
index 2e26541c1..0261bab53 100644
--- a/compiler-rt/lib/ctx_profile/CtxInstrProfiling.cpp
+++ b/compiler-rt/lib/ctx_profile/CtxInstrProfiling.cpp
@@ -55,7 +55,7 @@ void onFunctionExited(void *Address) {
}
// Returns true if it was entered the first time
-bool rootEnterIsFirst(void* Address) {
+bool rootEnterIsFirst(void *Address) {
bool Ret = true;
if (!EnteredContextAddress) {
EnteredContextAddress = Address;
@@ -67,14 +67,13 @@ bool rootEnterIsFirst(void* Address) {
}
// Return true if this also exits the root.
-bool exitsRoot(void* Address) {
+bool exitsRoot(void *Address) {
onFunctionExited(Address);
if (UnderContextRefCount == 0) {
EnteredContextAddress = nullptr;
return true;
}
return false;
-
}
bool hasEnteredARoot() { return UnderContextRefCount > 0; }
@@ -367,8 +366,7 @@ ContextNode *getOrStartContextOutsideCollection(FunctionData &Data,
// If we didn't start profiling, or if we are under a context, just not
// collecting, return the scratch buffer.
- if (hasEnteredARoot() ||
- !__sanitizer::atomic_load_relaxed(&ProfilingStarted))
+ if (hasEnteredARoot() || !__sanitizer::atomic_load_relaxed(&ProfilingStarted))
return TheScratchContext;
return markAsScratch(
onContextEnter(*getFlatProfile(Data, Callee, Guid, NumCounters)));
diff --git a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
index 39a225ac1..064608d28 100644
--- a/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
+++ b/compiler-rt/lib/ctx_profile/tests/CtxInstrProfilingTest.cpp
@@ -276,7 +276,7 @@ TEST_F(ContextTest, RootEntersOtherRoot) {
__llvm_ctx_profile_release_context(&Root);
EXPECT_EQ(__llvm_ctx_profile_current_context_root, Root.CtxRoot);
__llvm_ctx_profile_release_context(&Root);
- EXPECT_EQ(__llvm_ctx_profile_current_context_root, nullptr);
+ EXPECT_EQ(__llvm_ctx_profile_current_context_root, nullptr);
}
TEST_F(ContextTest, NeedMoreMemory) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/135656
More information about the llvm-branch-commits
mailing list