[cfe-commits] r119946 - in /cfe/trunk: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings.c

Anders Carlsson andersca at mac.com
Sun Nov 21 10:34:21 PST 2010


Author: andersca
Date: Sun Nov 21 12:34:21 2010
New Revision: 119946

URL: http://llvm.org/viewvc/llvm-project?rev=119946&view=rev
Log:
The 'X' printf type has a valid alternative form. Fixes PR8641.

Modified:
    cfe/trunk/lib/Analysis/PrintfFormatString.cpp
    cfe/trunk/test/Sema/format-strings.c

Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=119946&r1=119945&r2=119946&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Sun Nov 21 12:34:21 2010
@@ -501,10 +501,11 @@
   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:

Modified: cfe/trunk/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings.c?rev=119946&r1=119945&r2=119946&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings.c (original)
+++ cfe/trunk/test/Sema/format-strings.c Sun Nov 21 12:34:21 2010
@@ -325,3 +325,8 @@
   rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}}
 }
 
+// PR8641
+void pr8641() {
+  printf("%#x\n", 10);
+  printf("%#X\n", 10);
+}





More information about the cfe-commits mailing list