From owner-svn-src-head@FreeBSD.ORG Wed Oct 13 17:01:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 234481065672; Wed, 13 Oct 2010 17:01:34 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11A8D8FC08; Wed, 13 Oct 2010 17:01:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9DH1XT1093867; Wed, 13 Oct 2010 17:01:33 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9DH1XHB093865; Wed, 13 Oct 2010 17:01:33 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <201010131701.o9DH1XHB093865@svn.freebsd.org> From: Roman Divacky Date: Wed, 13 Oct 2010 17:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213786 - head/contrib/llvm/tools/clang/lib/Sema X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 17:01:34 -0000 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()