svn commit: r213786 - head/contrib/llvm/tools/clang/lib/Sema
Roman Divacky
rdivacky at FreeBSD.org
Wed Oct 13 17:01:34 UTC 2010
Author: rdivacky
Date: Wed Oct 13 17:01:33 2010
New Revision: 213786
URL: http://svn.freebsd.org/changeset/base/213786
Log:
Actually, check for any kind of "C string type".
Approved by: rpaulo (mentor)
Modified:
head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 16:57:06 2010 (r213785)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 17:01:33 2010 (r213786)
@@ -1519,14 +1519,10 @@ CheckPrintfHandler::HandlePrintfSpecifie
// Now type check the data expression that matches the
// format specifier.
const Expr *Ex = getDataArg(argIndex);
- QualType Pointee = S.Context.UnsignedCharTy;
- Pointee.addConst();
- QualType constType = (CS.getKind() == ConversionSpecifier::bArg) ? S.Context.IntTy : S.Context.getPointerType(Pointee);
- QualType type = (CS.getKind() == ConversionSpecifier::bArg) ? S.Context.IntTy : S.Context.getPointerType(S.Context.UnsignedCharTy);
- const analyze_printf::ArgTypeResult &ConstATR = constType;
- const analyze_printf::ArgTypeResult &ATR = type;
- if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()) &&
- !ConstATR.matchesType(S.Context, Ex->getType()))
+ const analyze_printf::ArgTypeResult &ATR =
+ (CS.getKind() == ConversionSpecifier::bArg) ?
+ ArgTypeResult(S.Context.IntTy) : ArgTypeResult::CStrTy;
+ if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()))
S.Diag(getLocationOfByte(CS.getStart()),
diag::warn_printf_conversion_argument_type_mismatch)
<< ATR.getRepresentativeType(S.Context) << Ex->getType()
More information about the svn-src-head
mailing list