aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/PrintfFormatString.cpp
diff options
context:
space:
mode:
authorTom Care <tcare@apple.com>2010-06-18 03:02:16 +0000
committerTom Care <tcare@apple.com>2010-06-18 03:02:16 +0000
commit6e4ea2db7fbd1686a2691b24b985b8320f0d2231 (patch)
tree0ba18ccb1daee2396332d24aa8ce44f3535b7837 /clang/lib/Analysis/PrintfFormatString.cpp
parente96a9132b89a808c4231e549a2748a52c731ba42 (diff)
downloadllvm-6e4ea2db7fbd1686a2691b24b985b8320f0d2231.zip
llvm-6e4ea2db7fbd1686a2691b24b985b8320f0d2231.tar.gz
llvm-6e4ea2db7fbd1686a2691b24b985b8320f0d2231.tar.bz2
Printf format strings: Added some more tests and fixed some minor bugs.
- Precision toStrings shouldn't print a dot when they have no value. - Length of char length modifier is now returned correctly. - Added several fixit tests. Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now. M test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp llvm-svn: 106275
Diffstat (limited to 'clang/lib/Analysis/PrintfFormatString.cpp')
-rw-r--r--clang/lib/Analysis/PrintfFormatString.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp
index 951be17..8ad1d21 100644
--- a/clang/lib/Analysis/PrintfFormatString.cpp
+++ b/clang/lib/Analysis/PrintfFormatString.cpp
@@ -611,20 +611,21 @@ const char *LengthModifier::toString() const {
//===----------------------------------------------------------------------===//
void OptionalAmount::toString(llvm::raw_ostream &os) const {
- if (UsesDotPrefix)
- os << ".";
-
switch (hs) {
case Invalid:
case NotSpecified:
return;
case Arg:
+ if (UsesDotPrefix)
+ os << ".";
if (usesPositionalArg())
os << "*" << getPositionalArgIndex() << "$";
else
os << "*";
break;
case Constant:
+ if (UsesDotPrefix)
+ os << ".";
os << amt;
break;
}