[PATCH] D158967: [clang][clangd] Ensure the stack bottom before building AST

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 31 11:27:25 PDT 2023


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/support/Threading.cpp:102
     llvm::set_thread_name(Name);
+    // Mark the bottom of the stack for clang to be aware of the stack usage and
+    // prevent stack overflow.
----------------
ugh, I forgot: this function is part of clangBasic (which is not small!) and clangdSupport shouldn't depend on clang at all.

I'm afraid the easiest fix is to move this to the tasks in the relevant callsites:
- indexStdlib() in ClangdServer.cpp
- ASTWorker::run(), PreambleWorker::run(), TUScheduler::runWithPreamble() in TUScheduler.cpp
- BackgroundIndex() in index/Background.cpp

(I guess principled thing would be to make noteBottomOfStack() part of llvm Support, but that seems complicated)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158967/new/

https://reviews.llvm.org/D158967



More information about the cfe-commits mailing list