diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-01-28 00:55:28 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-01-28 00:55:28 +0000 |
commit | c7cbb9bf8e0bf8c3191ef0b782ec198c433d2a4e (patch) | |
tree | 67482d24f5d22160dc9bafa2538bdded3bd98184 | |
parent | 0ac8f31af4a8f669700ab8fcad4ae1afc3517373 (diff) |
Add '@' conversion specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94713 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Analysis/Analyses/PrintfFormatString.h | 10 | ||||
-rw-r--r-- | lib/Analysis/PrintfFormatString.cpp | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/include/clang/Analysis/Analyses/PrintfFormatString.h b/include/clang/Analysis/Analyses/PrintfFormatString.h index 978486d271..c5bac8c726 100644 --- a/include/clang/Analysis/Analyses/PrintfFormatString.h +++ b/include/clang/Analysis/Analyses/PrintfFormatString.h @@ -24,6 +24,7 @@ class ConversionSpecifier { public: enum Kind { InvalidSpecifier = 0, + // C99 conversion specifiers. dArg, // 'd' iArg, // 'i', oArg, // 'o', @@ -43,12 +44,19 @@ public: VoidPtrArg, // 'p' OutIntPtrArg, // 'n' PercentArg, // '%' + // Objective-C specific specifiers. + ObjCObjArg, // '@' + // Specifier ranges. IntArgBeg = dArg, IntArgEnd = iArg, UIntArgBeg = oArg, UIntArgEnd = XArg, DoubleArgBeg = fArg, - DoubleArgEnd = AArg + DoubleArgEnd = AArg, + C99Beg = IntArgBeg, + C99End = DoubleArgEnd, + ObjCBeg = ObjCObjArg, + ObjCEnd = ObjCObjArg }; ConversionSpecifier(Kind k) : kind(k) {} diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index d7b9a21a3d..9907dc9d42 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -193,9 +193,8 @@ static FormatSpecifierResult ParseFormatSpecifier(printf::FormatStringHandler &H switch (*I) { default: H.HandleInvalidConversionSpecifier(I); - return true; - - // Handle the cases we know about. + return true; + // C99: 7.19.6.1 (section 8). case 'd': cs = ConversionSpecifier::dArg; break; case 'i': cs = ConversionSpecifier::iArg; break; case 'o': cs = ConversionSpecifier::oArg; break; @@ -214,7 +213,9 @@ static FormatSpecifierResult ParseFormatSpecifier(printf::FormatStringHandler &H case 's': cs = ConversionSpecifier::CStrArg; break; case 'p': cs = ConversionSpecifier::VoidPtrArg; break; case 'n': cs = ConversionSpecifier::OutIntPtrArg; break; - case '%': cs = ConversionSpecifier::PercentArg; break; + case '%': cs = ConversionSpecifier::PercentArg; break; + // Objective-C. + case '@': cs = ConversionSpecifier::ObjCObjArg; break; } FS.setConversionSpecifier(cs); return FormatSpecifierResult(Start, FS); |