aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Analysis/PrintfFormatString.cpp3
-rw-r--r--test/Sema/format-strings.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp
index 57399d8efe..88671017a8 100644
--- a/lib/Analysis/PrintfFormatString.cpp
+++ b/lib/Analysis/PrintfFormatString.cpp
@@ -501,10 +501,11 @@ bool PrintfSpecifier::hasValidAlternativeForm() const {
if (!HasAlternativeForm)
return true;
- // Alternate form flag only valid with the oxaAeEfFgG conversions
+ // Alternate form flag only valid with the oxXaAeEfFgG conversions
switch (CS.getKind()) {
case ConversionSpecifier::oArg:
case ConversionSpecifier::xArg:
+ case ConversionSpecifier::XArg:
case ConversionSpecifier::aArg:
case ConversionSpecifier::AArg:
case ConversionSpecifier::eArg:
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 57f087b2e0..ba5fa8a3a6 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -325,3 +325,8 @@ void rdar8332221(va_list ap, int *x, long *y) {
rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}}
}
+// PR8641
+void pr8641() {
+ printf("%#x\n", 10);
+ printf("%#X\n", 10);
+}