summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8dcc466886f856e602086c54533eeaf203fd48e8 (patch)
treec294b7a74bd0bee536bbb4f5c80d8d4933b4c023 /clang/lib/Analysis/PrintfFormatString.cpp
parent5a866c0bf23a8d81dabe9ee510681fb788114b1b (diff)
downloadbcm5719-llvm-8dcc466886f856e602086c54533eeaf203fd48e8.tar.gz
bcm5719-llvm-8dcc466886f856e602086c54533eeaf203fd48e8.zip
When generating printf fixits, preserve the original formating for unsigned integers (e.g., 'x', 'o').
llvm-svn: 130164
Diffstat (limited to 'clang/lib/Analysis/PrintfFormatString.cpp')
-rw-r--r--clang/lib/Analysis/PrintfFormatString.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp
index db9f7f2c834..19a9134c049 100644
--- a/clang/lib/Analysis/PrintfFormatString.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud