aboutsummaryrefslogtreecommitdiff
path: root/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
commit4c6021995032a898fb0502d5d1fd2df37638e57b (patch)
tree976728e47b1c21c39f913889a796575df60c2fc7 /lib/Analysis/PrintfFormatString.cpp
parent23d90f90413ff1efd7e4410d28ae2cab99af1fdb (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PrintfFormatString.cpp')
-rw-r--r--lib/Analysis/PrintfFormatString.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 951be17e2f..8ad1d21312 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/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;
}