aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PrintfFormatString.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-25 22:32:59 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-25 22:32:59 +0000
commit1e713f50e904b96623425efa7119fcb98243e111 (patch)
tree35856a951d66bf28c44537bb9c57eb0a604a60d8 /lib/Analysis/PrintfFormatString.cpp
parentec9919549095390b5737c561544f8bd49fc894de (diff)
When generating printf fixits, preserve the original formating for unsigned integers (e.g., 'x', 'o').
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PrintfFormatString.cpp')
-rw-r--r--lib/Analysis/PrintfFormatString.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index db9f7f2c83..19a9134c04 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -441,7 +441,9 @@ bool PrintfSpecifier::fixType(QualType QT) {
HasAlternativeForm = 0;
}
else if (QT->isUnsignedIntegerType()) {
- CS.setKind(ConversionSpecifier::uArg);
+ // Preserve the original formatting, e.g. 'X', 'o'.
+ if (!cast<PrintfConversionSpecifier>(CS).isUIntArg())
+ CS.setKind(ConversionSpecifier::uArg);
HasAlternativeForm = 0;
HasPlusPrefix = 0;
}