Skip to content

Commit fa21260

Browse files
committed
Address comments
1 parent e9a5b7a commit fa21260

7 files changed

+369
-359
lines changed

clang/include/clang/AST/FormatString.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -783,18 +783,6 @@ bool ParsePrintfString(FormatStringHandler &H,
783783
bool ParseFormatStringHasSArg(const char *beg, const char *end,
784784
const LangOptions &LO, const TargetInfo &Target);
785785

786-
/// Parse C format string and return index (relative to `ArgIndex`) of the first
787-
/// found `s` specifier. Return 0 if not found.
788-
/// \param I The start of the C format string; Updated to the first unparsed
789-
/// position upon return.
790-
/// \param E The end of the C format string;
791-
/// \param ArgIndex The argument index of the last found `s` specifier; Or the
792-
/// argument index of the formatter in initial case.
793-
unsigned ParseFormatStringFirstSArgIndex(const char *&I, const char *E,
794-
unsigned ArgIndex,
795-
const LangOptions &LO,
796-
const TargetInfo &Target);
797-
798786
bool ParseScanfString(FormatStringHandler &H,
799787
const char *beg, const char *end, const LangOptions &LO,
800788
const TargetInfo &Target);

clang/lib/AST/PrintfFormatString.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -483,34 +483,6 @@ bool clang::analyze_format_string::ParseFormatStringHasSArg(const char *I,
483483
return false;
484484
}
485485

486-
unsigned clang::analyze_format_string::ParseFormatStringFirstSArgIndex(
487-
const char *&I, const char *E, unsigned ArgIndex, const LangOptions &LO,
488-
const TargetInfo &Target) {
489-
unsigned argIndex = ArgIndex;
490-
491-
// Keep looking for a %s format specifier until we have exhausted the string.
492-
FormatStringHandler H;
493-
while (I != E) {
494-
const PrintfSpecifierResult &FSR =
495-
ParsePrintfSpecifier(H, I, E, argIndex, LO, Target, false, false);
496-
// Did a fail-stop error of any kind occur when parsing the specifier?
497-
// If so, don't do any more processing.
498-
if (FSR.shouldStop())
499-
return false;
500-
// Did we exhaust the string or encounter an error that
501-
// we can recover from?
502-
if (!FSR.hasValue())
503-
continue;
504-
const analyze_printf::PrintfSpecifier &FS = FSR.getValue();
505-
// Return true if this a %s format specifier.
506-
if (FS.getConversionSpecifier().getKind() ==
507-
ConversionSpecifier::Kind::sArg) {
508-
return FS.getPositionalArgIndex();
509-
}
510-
}
511-
return false;
512-
}
513-
514486
bool clang::analyze_format_string::parseFormatStringHasFormattingSpecifiers(
515487
const char *Begin, const char *End, const LangOptions &LO,
516488
const TargetInfo &Target) {

0 commit comments

Comments
 (0)