[clang] [clang] Prevent stack overflow during recursive ADL (PR #242618)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 29 06:47:15 PST 2026
================
@@ -2572,14 +2580,16 @@ printTo(raw_ostream &OS, ArrayRef<TA> Args, const PrintingPolicy &Policy,
SmallString<128> Buf;
llvm::raw_svector_ostream ArgOS(Buf);
const TemplateArgument &Argument = getArgument(Arg);
- if (Argument.getKind() == TemplateArgument::Pack) {
- if (Argument.pack_size() && !FirstArg)
- OS << Comma;
+ bool IsArgumentPack = Argument.getKind() == TemplateArgument::Pack;
+ bool HasArgument = !IsArgumentPack || Argument.pack_size() != 0;
+ if (HasArgument && !FirstArg)
+ OS << Comma;
+ if (HasArgument && isStackNearlyExhausted()) {
+ ArgOS << "...";
----------------
zyn0217 wrote:
@erichkeane Is this something https://github.com/llvm/llvm-project/pull/239419/ would handle?
https://github.com/llvm/llvm-project/pull/242618
More information about the cfe-commits
mailing list