From owner-svn-src-all@freebsd.org Sat Sep 7 11:21:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86602EDC10; Sat, 7 Sep 2019 11:21:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46QX7f35vcz4PTl; Sat, 7 Sep 2019 11:21:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CB9B4D10; Sat, 7 Sep 2019 11:21:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x87BLoNQ035900; Sat, 7 Sep 2019 11:21:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x87BLnLd035895; Sat, 7 Sep 2019 11:21:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909071121.x87BLnLd035895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 7 Sep 2019 11:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r351982 - in vendor/clang/dist-release_90: include/clang/Basic lib/AST lib/Driver lib/Driver/ToolChains lib/StaticAnalyzer/Checkers X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_90: include/clang/Basic lib/AST lib/Driver lib/Driver/ToolChains lib/StaticAnalyzer/Checkers X-SVN-Commit-Revision: 351982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2019 11:21:50 -0000 Author: dim Date: Sat Sep 7 11:21:48 2019 New Revision: 351982 URL: https://svnweb.freebsd.org/changeset/base/351982 Log: Vendor import of clang release_90 branch r371301: https://llvm.org/svn/llvm-project/cfe/branches/release_90@371301 Modified: vendor/clang/dist-release_90/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist-release_90/lib/AST/ASTContext.cpp vendor/clang/dist-release_90/lib/Driver/Driver.cpp vendor/clang/dist-release_90/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist-release_90/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp Modified: vendor/clang/dist-release_90/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- vendor/clang/dist-release_90/include/clang/Basic/DiagnosticDriverKinds.td Sat Sep 7 11:21:46 2019 (r351981) +++ vendor/clang/dist-release_90/include/clang/Basic/DiagnosticDriverKinds.td Sat Sep 7 11:21:48 2019 (r351982) @@ -91,8 +91,6 @@ def err_no_external_assembler : Error< "there is no external assembler that can be used on this platform">; def err_drv_unable_to_remove_file : Error< "unable to remove file: %0">; -def err_drv_unable_to_set_working_directory : Error < - "unable to set working directory: %0">; def err_drv_command_failure : Error< "unable to execute command: %0">; def err_drv_invalid_darwin_version : Error< Modified: vendor/clang/dist-release_90/lib/AST/ASTContext.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/AST/ASTContext.cpp Sat Sep 7 11:21:46 2019 (r351981) +++ vendor/clang/dist-release_90/lib/AST/ASTContext.cpp Sat Sep 7 11:21:48 2019 (r351982) @@ -9814,10 +9814,25 @@ static GVALinkage basicGVALinkageForVariable(const AST return StrongLinkage; case TSK_ExplicitSpecialization: - return Context.getTargetInfo().getCXXABI().isMicrosoft() && - VD->isStaticDataMember() - ? GVA_StrongODR - : StrongLinkage; + if (Context.getTargetInfo().getCXXABI().isMicrosoft()) { + // If this is a fully specialized constexpr variable template, pretend it + // was marked inline. MSVC 14.21.27702 headers define _Is_integral in a + // header this way, and we don't want to emit non-discardable definitions + // of these variables in every TU that includes . This + // behavior is non-conforming, since another TU could use an extern + // template declaration for this variable, but for constexpr variables, + // it's unlikely for a user to want to do that. This behavior can be + // removed if the headers change to explicitly mark such variable template + // specializations inline. + if (isa(VD) && VD->isConstexpr()) + return GVA_DiscardableODR; + + // Use ODR linkage for static data members of fully specialized templates + // to prevent duplicate definition errors with MSVC. + if (VD->isStaticDataMember()) + return GVA_StrongODR; + } + return StrongLinkage; case TSK_ExplicitInstantiationDefinition: return GVA_StrongODR; Modified: vendor/clang/dist-release_90/lib/Driver/Driver.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/Driver/Driver.cpp Sat Sep 7 11:21:46 2019 (r351981) +++ vendor/clang/dist-release_90/lib/Driver/Driver.cpp Sat Sep 7 11:21:48 2019 (r351982) @@ -133,7 +133,7 @@ Driver::Driver(StringRef ClangExecutable, StringRef Ta // Provide a sane fallback if no VFS is specified. if (!this->VFS) - this->VFS = llvm::vfs::createPhysicalFileSystem().release(); + this->VFS = llvm::vfs::getRealFileSystem(); Name = llvm::sys::path::filename(ClangExecutable); Dir = llvm::sys::path::parent_path(ClangExecutable); @@ -1010,11 +1010,6 @@ Compilation *Driver::BuildCompilation(ArrayRefsetCurrentWorkingDirectory(WD->getValue())) - Diag(diag::err_drv_unable_to_set_working_directory) << WD->getValue(); - // FIXME: This stuff needs to go into the Compilation, not the driver. bool CCCPrintPhases; @@ -1995,11 +1990,20 @@ bool Driver::DiagnoseInputExistence(const DerivedArgLi if (Value == "-") return true; - if (getVFS().exists(Value)) + SmallString<64> Path(Value); + if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) { + if (!llvm::sys::path::is_absolute(Path)) { + SmallString<64> Directory(WorkDir->getValue()); + llvm::sys::path::append(Directory, Value); + Path.assign(Directory); + } + } + + if (getVFS().exists(Path)) return true; if (IsCLMode()) { - if (!llvm::sys::path::is_absolute(Twine(Value)) && + if (!llvm::sys::path::is_absolute(Twine(Path)) && llvm::sys::Process::FindInEnvPath("LIB", Value)) return true; @@ -2025,12 +2029,12 @@ bool Driver::DiagnoseInputExistence(const DerivedArgLi if (getOpts().findNearest(Value, Nearest, IncludedFlagsBitmask, ExcludedFlagsBitmask) <= 1) { Diag(clang::diag::err_drv_no_such_file_with_suggestion) - << Value << Nearest; + << Path << Nearest; return false; } } - Diag(clang::diag::err_drv_no_such_file) << Value; + Diag(clang::diag::err_drv_no_such_file) << Path; return false; } Modified: vendor/clang/dist-release_90/lib/Driver/ToolChains/Clang.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/Driver/ToolChains/Clang.cpp Sat Sep 7 11:21:46 2019 (r351981) +++ vendor/clang/dist-release_90/lib/Driver/ToolChains/Clang.cpp Sat Sep 7 11:21:48 2019 (r351982) @@ -603,15 +603,16 @@ static bool shouldUseLeafFramePointer(const ArgList &A } /// Add a CC1 option to specify the debug compilation directory. -static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs, - const llvm::vfs::FileSystem &VFS) { +static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) { if (Arg *A = Args.getLastArg(options::OPT_fdebug_compilation_dir)) { CmdArgs.push_back("-fdebug-compilation-dir"); CmdArgs.push_back(A->getValue()); - } else if (llvm::ErrorOr CWD = - VFS.getCurrentWorkingDirectory()) { - CmdArgs.push_back("-fdebug-compilation-dir"); - CmdArgs.push_back(Args.MakeArgString(*CWD)); + } else { + SmallString<128> cwd; + if (!llvm::sys::fs::current_path(cwd)) { + CmdArgs.push_back("-fdebug-compilation-dir"); + CmdArgs.push_back(Args.MakeArgString(cwd)); + } } } @@ -877,8 +878,13 @@ static void addPGOAndCoverageFlags(const ToolChain &TC else OutputFilename = llvm::sys::path::filename(Output.getBaseInput()); SmallString<128> CoverageFilename = OutputFilename; - if (llvm::sys::path::is_relative(CoverageFilename)) - (void)D.getVFS().makeAbsolute(CoverageFilename); + if (llvm::sys::path::is_relative(CoverageFilename)) { + SmallString<128> Pwd; + if (!llvm::sys::fs::current_path(Pwd)) { + llvm::sys::path::append(Pwd, CoverageFilename); + CoverageFilename.swap(Pwd); + } + } llvm::sys::path::replace_extension(CoverageFilename, "gcno"); CmdArgs.push_back(Args.MakeArgString(CoverageFilename)); @@ -4365,7 +4371,7 @@ void Clang::ConstructJob(Compilation &C, const JobActi CmdArgs.push_back("-fno-autolink"); // Add in -fdebug-compilation-dir if necessary. - addDebugCompDirArg(Args, CmdArgs, D.getVFS()); + addDebugCompDirArg(Args, CmdArgs); addDebugPrefixMapArg(D, Args, CmdArgs); @@ -6092,7 +6098,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAc DebugInfoKind = (WantDebug ? codegenoptions::LimitedDebugInfo : codegenoptions::NoDebugInfo); // Add the -fdebug-compilation-dir flag if needed. - addDebugCompDirArg(Args, CmdArgs, C.getDriver().getVFS()); + addDebugCompDirArg(Args, CmdArgs); addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs); Modified: vendor/clang/dist-release_90/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp ============================================================================== --- vendor/clang/dist-release_90/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp Sat Sep 7 11:21:46 2019 (r351981) +++ vendor/clang/dist-release_90/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp Sat Sep 7 11:21:48 2019 (r351982) @@ -91,6 +91,22 @@ void EnumCastOutOfRangeChecker::reportWarning(CheckerC void EnumCastOutOfRangeChecker::checkPreStmt(const CastExpr *CE, CheckerContext &C) const { + + // Only perform enum range check on casts where such checks are valid. For + // all other cast kinds (where enum range checks are unnecessary or invalid), + // just return immediately. TODO: The set of casts whitelisted for enum + // range checking may be incomplete. Better to add a missing cast kind to + // enable a missing check than to generate false negatives and have to remove + // those later. + switch (CE->getCastKind()) { + case CK_IntegralCast: + break; + + default: + return; + break; + } + // Get the value of the expression to cast. const llvm::Optional ValueToCast = C.getSVal(CE->getSubExpr()).getAs();