summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ScanfFormatString.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-29 20:49:54 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-29 20:49:54 +0000
commit58fc8082a89f51a7cec210fa57c301bcb754aef0 (patch)
tree97dfdac10ccd9f336e77f49ad32a2f93b2588e22 /clang/lib/AST/ScanfFormatString.cpp
parent297afb14ec82180021aa1b2f02abd3c8c5e4c475 (diff)
downloadbcm5719-llvm-58fc8082a89f51a7cec210fa57c301bcb754aef0.tar.gz
bcm5719-llvm-58fc8082a89f51a7cec210fa57c301bcb754aef0.zip
OpenCL: Use length modifier for warning on vector printf arguments
Re-enable format string warnings on printf. The warnings are still incomplete. Apparently it is undefined to use a vector specifier without a length modifier, which is not currently warned on. Additionally, type warnings appear to not be working with the hh modifier, and aren't warning on all of the special restrictions from c99 printf. llvm-svn: 352540
Diffstat (limited to 'clang/lib/AST/ScanfFormatString.cpp')
-rw-r--r--clang/lib/AST/ScanfFormatString.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/AST/ScanfFormatString.cpp b/clang/lib/AST/ScanfFormatString.cpp
index ff4883305a7..1a87de70f86 100644
--- a/clang/lib/AST/ScanfFormatString.cpp
+++ b/clang/lib/AST/ScanfFormatString.cpp
@@ -261,9 +261,10 @@ ArgType ScanfSpecifier::getArgType(ASTContext &Ctx) const {
case LengthModifier::AsInt32:
case LengthModifier::AsInt3264:
case LengthModifier::AsWide:
+ case LengthModifier::AsShortLong:
return ArgType::Invalid();
}
- llvm_unreachable("Unsupported LenghtModifier Type");
+ llvm_unreachable("Unsupported LengthModifier Type");
// Unsigned int.
case ConversionSpecifier::oArg:
@@ -301,9 +302,10 @@ ArgType ScanfSpecifier::getArgType(ASTContext &Ctx) const {
case LengthModifier::AsInt32:
case LengthModifier::AsInt3264:
case LengthModifier::AsWide:
+ case LengthModifier::AsShortLong:
return ArgType::Invalid();
}
- llvm_unreachable("Unsupported LenghtModifier Type");
+ llvm_unreachable("Unsupported LengthModifier Type");
// Float.
case ConversionSpecifier::aArg:
@@ -396,6 +398,7 @@ ArgType ScanfSpecifier::getArgType(ASTContext &Ctx) const {
case LengthModifier::AsInt32:
case LengthModifier::AsInt3264:
case LengthModifier::AsWide:
+ case LengthModifier::AsShortLong:
return ArgType::Invalid();
}
@@ -501,7 +504,7 @@ bool ScanfSpecifier::fixType(QualType QT, QualType RawQT,
namedTypeToLengthModifier(PT, LM);
// If fixing the length modifier was enough, we are done.
- if (hasValidLengthModifier(Ctx.getTargetInfo())) {
+ if (hasValidLengthModifier(Ctx.getTargetInfo(), LangOpt)) {
const analyze_scanf::ArgType &AT = getArgType(Ctx);
if (AT.isValid() && AT.matchesType(Ctx, QT))
return true;
OpenPOWER on IntegriCloud