From: Ted Kremenek Date: Thu, 28 Jan 2010 01:00:59 +0000 (+0000) Subject: Allow HandleFormatSpecifier() to indicate that no more processing of the format strin... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5f2096e266b7905df660b7839e69e9ed6ba9018;p=clang Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94715 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/Analyses/PrintfFormatString.h b/include/clang/Analysis/Analyses/PrintfFormatString.h index c5bac8c726..6ae7e0c6e9 100644 --- a/include/clang/Analysis/Analyses/PrintfFormatString.h +++ b/include/clang/Analysis/Analyses/PrintfFormatString.h @@ -176,9 +176,9 @@ public: virtual void HandleInvalidConversionSpecifier(const char *conversionChar) {} - virtual void HandleFormatSpecifier(const FormatSpecifier &FS, + virtual bool HandleFormatSpecifier(const FormatSpecifier &FS, const char *startSpecifier, - const char *endSpecifier) {} + const char *endSpecifier) { return false; } }; bool ParseFormatString(FormatStringHandler &H, diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 9907dc9d42..1afa9ad2b7 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -233,7 +233,8 @@ bool ParseFormatSring(FormatStringHandler &H, const char *I, const char *E) { if (!FSR.hasValue()) break; // We have a format specifier. Pass it to the callback. - H.HandleFormatSpecifier(FSR.getValue(), FSR.getStart(), I); + if (!H.HandleFormatSpecifier(FSR.getValue(), FSR.getStart(), I)) + return false; } assert(I == E && "Format string not exhausted"); return false;