[clang] [clang] Deduplicate the logic that only warns once when stack is almost full (PR #112371)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 07:52:11 PDT 2024
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 f314e12494ed73290983a7db8e15c21578f437b3 b4c0afe1b691ce4e48b74884ac771a7038bd5de2 --extensions cpp,h -- clang/include/clang/Basic/Stack.h clang/include/clang/Sema/Sema.h clang/include/clang/Serialization/ASTReader.h clang/lib/Basic/Stack.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaTemplateInstantiate.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderDecl.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Basic/Stack.h b/clang/include/clang/Basic/Stack.h
index 64367d8519..e9ea4335a5 100644
--- a/clang/include/clang/Basic/Stack.h
+++ b/clang/include/clang/Basic/Stack.h
@@ -53,29 +53,29 @@ namespace clang {
#endif
}
-class SingleWarningStackAwareExecutor {
-public:
- SingleWarningStackAwareExecutor(DiagnosticsEngine &diags)
- : DiagsRef(diags) {}
+ class SingleWarningStackAwareExecutor {
+ public:
+ SingleWarningStackAwareExecutor(DiagnosticsEngine &diags)
+ : DiagsRef(diags) {}
- /// Run some code with "sufficient" stack space. (Currently, at least 256K
- /// is guaranteed). Produces a warning if we're low on stack space and
- /// allocates more in that case. Use this in code that may recurse deeply to
- /// avoid stack overflow.
- void runWithSufficientStackSpace(SourceLocation Loc,
- llvm::function_ref<void()> Fn);
+ /// Run some code with "sufficient" stack space. (Currently, at least 256K
+ /// is guaranteed). Produces a warning if we're low on stack space and
+ /// allocates more in that case. Use this in code that may recurse deeply to
+ /// avoid stack overflow.
+ void runWithSufficientStackSpace(SourceLocation Loc,
+ llvm::function_ref<void()> Fn);
- /// Check to see if we're low on stack space and produce a warning if we're
- /// low on stack space (Currently, at least 256Kis guaranteed).
- void warnOnStackNearlyExhausted(SourceLocation Loc);
+ /// Check to see if we're low on stack space and produce a warning if we're
+ /// low on stack space (Currently, at least 256Kis guaranteed).
+ void warnOnStackNearlyExhausted(SourceLocation Loc);
-private:
- /// Warn that the stack is nearly exhausted.
- void warnStackExhausted(SourceLocation Loc);
+ private:
+ /// Warn that the stack is nearly exhausted.
+ void warnStackExhausted(SourceLocation Loc);
- DiagnosticsEngine &DiagsRef;
- bool WarnedStackExhausted = false;
-};
+ DiagnosticsEngine &DiagsRef;
+ bool WarnedStackExhausted = false;
+ };
} // end namespace clang
``````````
</details>
https://github.com/llvm/llvm-project/pull/112371
More information about the cfe-commits
mailing list