OpenCL: Don't warn on v printf modifier
This avoids spurious warnings, but could use
a lot of work. For example the number of vector
elements is not verified, and the passed
value type is not checked.
Fixes bug 39486
llvm-svn: 346806
diff --git a/clang/lib/AST/FormatString.cpp b/clang/lib/AST/FormatString.cpp
index 5e2137c..565bd03 100644
--- a/clang/lib/AST/FormatString.cpp
+++ b/clang/lib/AST/FormatString.cpp
@@ -618,6 +618,9 @@
// MS specific specifiers.
case ZArg: return "Z";
+
+ // OpenCL specific specifiers.
+ case VArg: return "v";
}
return nullptr;
}
@@ -875,6 +878,8 @@
case ConversionSpecifier::CArg:
case ConversionSpecifier::SArg:
return LangOpt.ObjC;
+ case ConversionSpecifier::VArg:
+ return LangOpt.OpenCL;
case ConversionSpecifier::InvalidSpecifier:
case ConversionSpecifier::FreeBSDbArg:
case ConversionSpecifier::FreeBSDDArg:
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index f22c4f8..877f890 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -362,6 +362,12 @@
case 'Z':
if (Target.getTriple().isOSMSVCRT())
k = ConversionSpecifier::ZArg;
+ break;
+ // OpenCL specific.
+ case 'v':
+ if (LO.OpenCL)
+ k = ConversionSpecifier::VArg;
+ break;
}
// Check to see if we used the Objective-C modifier flags with
@@ -1026,6 +1032,7 @@
case ConversionSpecifier::FreeBSDrArg:
case ConversionSpecifier::FreeBSDyArg:
case ConversionSpecifier::PArg:
+ case ConversionSpecifier::VArg:
return true;
default: