aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorBoaz Brickner <brickner@google.com>2024-10-18 10:11:14 +0200
committerGitHub <noreply@github.com>2024-10-18 10:11:14 +0200
commit09cc75e2ccc3616e1cb3b17f2fb99cb3bb323b12 (patch)
tree3fb09cfb81653281ca4a9647f3a2d71106d31ce4 /clang/lib/Sema/Sema.cpp
parent508fd966fb00428ccd1dd7ddeb636fb7393029ec (diff)
downloadllvm-09cc75e2ccc3616e1cb3b17f2fb99cb3bb323b12.zip
llvm-09cc75e2ccc3616e1cb3b17f2fb99cb3bb323b12.tar.gz
llvm-09cc75e2ccc3616e1cb3b17f2fb99cb3bb323b12.tar.bz2
[clang] Deduplicate the logic that only warns once when stack is almost full (#112552)
Zero diff in behavior.
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index f0d1634..5e9886a 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -220,7 +220,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
AnalysisWarnings(*this), ThreadSafetyDeclCache(nullptr),
LateTemplateParser(nullptr), LateTemplateParserCleanup(nullptr),
OpaqueParser(nullptr), CurContext(nullptr), ExternalSource(nullptr),
- CurScope(nullptr), Ident_super(nullptr),
+ StackHandler(Diags), CurScope(nullptr), Ident_super(nullptr),
AMDGPUPtr(std::make_unique<SemaAMDGPU>(*this)),
ARMPtr(std::make_unique<SemaARM>(*this)),
AVRPtr(std::make_unique<SemaAVR>(*this)),
@@ -562,17 +562,9 @@ Sema::~Sema() {
SemaPPCallbackHandler->reset();
}
-void Sema::warnStackExhausted(SourceLocation Loc) {
- // Only warn about this once.
- if (!WarnedStackExhausted) {
- Diag(Loc, diag::warn_stack_exhausted);
- WarnedStackExhausted = true;
- }
-}
-
void Sema::runWithSufficientStackSpace(SourceLocation Loc,
llvm::function_ref<void()> Fn) {
- clang::runWithSufficientStackSpace([&] { warnStackExhausted(Loc); }, Fn);
+ StackHandler.runWithSufficientStackSpace(Loc, Fn);
}
bool Sema::makeUnavailableInSystemHeader(SourceLocation loc,