================ @@ -483,6 +483,34 @@ bool clang::analyze_format_string::ParseFormatStringHasSArg(const char *I, return false; } +unsigned clang::analyze_format_string::ParseFormatStringFirstSArgIndex( + const char *&I, const char *E, unsigned ArgIndex, const LangOptions &LO, + const TargetInfo &Target) { + unsigned argIndex = ArgIndex; + + // Keep looking for a %s format specifier until we have exhausted the string. + FormatStringHandler H; + while (I != E) { + const PrintfSpecifierResult &FSR = + ParsePrintfSpecifier(H, I, E, argIndex, LO, Target, false, false); + // Did a fail-stop error of any kind occur when parsing the specifier? + // If so, don't do any more processing. + if (FSR.shouldStop()) ---------------- haoNoQ wrote:
Is this any easier than simply overriding `HandlePrintfSpecifier()` and `HandleScanfSpecifier()` in `FormatStringHandler` to tell you everything you need in a simple mostly-statically-typed manner? https://github.com/llvm/llvm-project/pull/101583 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits