[clang] Clang Static Analyzer: Fix stack overflow in template-heavy code (PR #184767)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 02:29:59 PST 2026


forall-x wrote:

> > > What alternative implementations have you considered? I think we can both agree on that we shouldn't use global variables.
> > 
> > 
> > It's thread local.  Maybe the name should be changed to reflect that?
> 
> That doesn't change the fact that it's a global variable. Yes, it has thread local storage. My question is whether you have considered other approaches achieving a similar effect without using global variables.
> 
> I think we should explore other options before we introduce mutable global state.

Thanks for the feedback.  I looked into passing a depth counter on the stack with ProgramState.  Please take a look: https://github.com/llvm/llvm-project/compare/main...forall-x:llvm-project:fix-sa-iterative-experiment

I think this is indeed preferable to  mutable global state.  If you agree I will go with that.

https://github.com/llvm/llvm-project/pull/184767


More information about the cfe-commits mailing list