зеркало из https://github.com/microsoft/clang.git
Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95324 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
789b1f6402
Коммит
74d56a1689
|
@ -234,8 +234,6 @@ public:
|
|||
bool hasLeadingZeros() const { return (bool) HasLeadingZeroes; }
|
||||
};
|
||||
|
||||
} // end printf namespace
|
||||
|
||||
class FormatStringHandler {
|
||||
public:
|
||||
FormatStringHandler() {}
|
||||
|
@ -261,6 +259,6 @@ public:
|
|||
bool ParseFormatString(FormatStringHandler &H,
|
||||
const char *beg, const char *end);
|
||||
|
||||
|
||||
} // end printf namespace
|
||||
} // end clang namespace
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
using clang::analyze_printf::FormatSpecifier;
|
||||
using clang::analyze_printf::OptionalAmount;
|
||||
using clang::analyze_printf::ArgTypeResult;
|
||||
using clang::analyze_printf::FormatStringHandler;
|
||||
using namespace clang;
|
||||
|
||||
namespace {
|
||||
|
@ -87,7 +88,8 @@ static OptionalAmount ParseAmount(const char *&Beg, const char *E) {
|
|||
}
|
||||
|
||||
static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
|
||||
const char *&Beg, const char *E) {
|
||||
const char *&Beg,
|
||||
const char *E) {
|
||||
|
||||
using namespace clang::analyze_printf;
|
||||
|
||||
|
@ -241,7 +243,7 @@ static FormatSpecifierResult ParseFormatSpecifier(FormatStringHandler &H,
|
|||
return FormatSpecifierResult(Start, FS);
|
||||
}
|
||||
|
||||
bool clang::ParseFormatString(FormatStringHandler &H,
|
||||
bool clang::analyze_printf::ParseFormatString(FormatStringHandler &H,
|
||||
const char *I, const char *E) {
|
||||
// Keep looking for a format specifier until we have exhausted the string.
|
||||
while (I != E) {
|
||||
|
|
|
@ -1033,7 +1033,7 @@ Sema::CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg,
|
|||
}
|
||||
|
||||
namespace {
|
||||
class CheckPrintfHandler : public FormatStringHandler {
|
||||
class CheckPrintfHandler : public analyze_printf::FormatStringHandler {
|
||||
Sema &S;
|
||||
const StringLiteral *FExpr;
|
||||
const Expr *OrigFormatExpr;
|
||||
|
@ -1061,9 +1061,10 @@ public:
|
|||
void HandleIncompleteFormatSpecifier(const char *startSpecifier,
|
||||
unsigned specifierLen);
|
||||
|
||||
void HandleInvalidConversionSpecifier(const analyze_printf::FormatSpecifier &FS,
|
||||
const char *startSpecifier,
|
||||
unsigned specifierLen);
|
||||
void
|
||||
HandleInvalidConversionSpecifier(const analyze_printf::FormatSpecifier &FS,
|
||||
const char *startSpecifier,
|
||||
unsigned specifierLen);
|
||||
|
||||
void HandleNullChar(const char *nullCharacter);
|
||||
|
||||
|
@ -1292,9 +1293,9 @@ CheckPrintfHandler::HandleFormatSpecifier(const analyze_printf::FormatSpecifier
|
|||
|
||||
S.Diag(getLocationOfByte(CS.getStart()),
|
||||
diag::warn_printf_conversion_argument_type_mismatch)
|
||||
<< *T << Ex->getType()
|
||||
<< getFormatSpecifierRange(startSpecifier, specifierLen)
|
||||
<< Ex->getSourceRange();
|
||||
<< *T << Ex->getType();
|
||||
// << getFormatSpecifierRange(startSpecifier, specifierLen)
|
||||
// << Ex->getSourceRange();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1341,7 +1342,7 @@ void Sema::CheckPrintfString(const StringLiteral *FExpr,
|
|||
isa<ObjCStringLiteral>(OrigFormatExpr), Str,
|
||||
HasVAListArg, TheCall, format_idx);
|
||||
|
||||
if (!ParseFormatString(H, Str, Str + StrLen))
|
||||
if (!analyze_printf::ParseFormatString(H, Str, Str + StrLen))
|
||||
H.DoneProcessing();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче