diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2010-10-11 17:18:23 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2010-10-11 17:18:23 +0000 |
commit | f4f7191cd223adebacee3fad260ed60935be9cb9 (patch) | |
tree | 02ab6d23d84ff5f8105b26c4eeb9ca9dc922aaae /contrib/llvm | |
parent | b70c0f5aa8b46d37430be4bf0d5a770769e053f7 (diff) | |
download | FreeBSD-src-f4f7191cd223adebacee3fad260ed60935be9cb9.zip FreeBSD-src-f4f7191cd223adebacee3fad260ed60935be9cb9.tar.gz |
Rework the analysis of the 'r' specifier. It turns out that we can't
make it like xArg because they are different ('x' doesn't accept sign,
but 'r' does).
This fixes some warnings when building DDB with clang.
With help from: rdivacky
Diffstat (limited to 'contrib/llvm')
3 files changed, 7 insertions, 1 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/FormatString.h b/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/FormatString.h index 60cf041..08200d3 100644 --- a/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/FormatString.h +++ b/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/FormatString.h @@ -147,6 +147,7 @@ public: // FreeBSD specific specifiers bArg, DArg, + rArg, // GlibC specific specifiers. PrintErrno, // 'm' diff --git a/contrib/llvm/tools/clang/lib/Analysis/FormatString.cpp b/contrib/llvm/tools/clang/lib/Analysis/FormatString.cpp index 388b9d3..e57258e 100644 --- a/contrib/llvm/tools/clang/lib/Analysis/FormatString.cpp +++ b/contrib/llvm/tools/clang/lib/Analysis/FormatString.cpp @@ -423,6 +423,7 @@ bool FormatSpecifier::hasValidLengthModifier() const { case ConversionSpecifier::xArg: case ConversionSpecifier::XArg: case ConversionSpecifier::nArg: + case ConversionSpecifier::rArg: return true; default: return false; @@ -448,6 +449,7 @@ bool FormatSpecifier::hasValidLengthModifier() const { case ConversionSpecifier::nArg: case ConversionSpecifier::cArg: case ConversionSpecifier::sArg: + case ConversionSpecifier::rArg: return true; default: return false; diff --git a/contrib/llvm/tools/clang/lib/Analysis/PrintfFormatString.cpp b/contrib/llvm/tools/clang/lib/Analysis/PrintfFormatString.cpp index 10589e6..1e9601a 100644 --- a/contrib/llvm/tools/clang/lib/Analysis/PrintfFormatString.cpp +++ b/contrib/llvm/tools/clang/lib/Analysis/PrintfFormatString.cpp @@ -195,7 +195,7 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H, case 'm': k = ConversionSpecifier::PrintErrno; break; // FreeBSD format extensions case 'b': if (FormatExtensions) k = ConversionSpecifier::bArg; break; /* check for int and then char * */ - case 'r': if (FormatExtensions) k = ConversionSpecifier::xArg; break; + case 'r': if (FormatExtensions) k = ConversionSpecifier::rArg; break; case 'y': if (FormatExtensions) k = ConversionSpecifier::iArg; break; case 'D': if (FormatExtensions) k = ConversionSpecifier::DArg; break; /* check for u_char * pointer and a char * string */ } @@ -279,6 +279,7 @@ const char *ConversionSpecifier::toString() const { // FreeBSD specific specifiers. case bArg: return "b"; case DArg: return "D"; + case rArg: return "r"; // GlibC specific specifiers. case PrintErrno: return "m"; @@ -491,6 +492,7 @@ bool PrintfSpecifier::hasValidPlusPrefix() const { case ConversionSpecifier::GArg: case ConversionSpecifier::aArg: case ConversionSpecifier::AArg: + case ConversionSpecifier::rArg: return true; default: @@ -514,6 +516,7 @@ bool PrintfSpecifier::hasValidAlternativeForm() const { case ConversionSpecifier::FArg: case ConversionSpecifier::gArg: case ConversionSpecifier::GArg: + case ConversionSpecifier::rArg: return true; default: |