From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:14 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24AB0D51BDC; Wed, 26 Apr 2017 19:24:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id ACAE98D6; Wed, 26 Apr 2017 19:24:13 +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 v3QJOCws030264; Wed, 26 Apr 2017 19:24:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJO9nr030234; Wed, 26 Apr 2017 19:24:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJO9nr030234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317447 - in vendor/clang/dist: cmake/caches docs include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Basic include/clang/Driver include/clang/Format include/clang... X-SVN-Group: vendor 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.23 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: Wed, 26 Apr 2017 19:24:14 -0000 Author: dim Date: Wed Apr 26 19:24:09 2017 New Revision: 317447 URL: https://svnweb.freebsd.org/changeset/base/317447 Log: Vendor import of clang trunk r301441: https://llvm.org/svn/llvm-project/cfe/trunk@301441 Added: vendor/clang/dist/test/Analysis/null-deref-offsets.c (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/ vendor/clang/dist/test/CXX/modules-ts/basic/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/codegen-basics.cppm vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/asan-globals-gc.cpp (contents, props changed) vendor/clang/dist/test/CoverageMapping/empty-destructor.cpp (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/fuzzer.c (contents, props changed) vendor/clang/dist/test/Index/Core/external-source-symbol-attr.m vendor/clang/dist/test/Modules/Inputs/objc-desig-init/ vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A2.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/Base.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/X.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/module.modulemap vendor/clang/dist/test/Modules/objc-designated-init-mod.m vendor/clang/dist/test/OpenMP/capturing_in_templates.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_if_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_private_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp (contents, props changed) vendor/clang/dist/test/SemaObjCXX/pr32725.mm Deleted: vendor/clang/dist/test/CodeGenCXX/modules-ts.cppm vendor/clang/dist/test/Parser/cxx-modules-import.cpp vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake vendor/clang/dist/docs/ClangFormat.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/CommentSema.h vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h vendor/clang/dist/include/clang/Basic/Diagnostic.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/Module.h vendor/clang/dist/include/clang/Basic/Sanitizers.def vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/SanitizerArgs.h vendor/clang/dist/include/clang/Format/Format.h vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def vendor/clang/dist/include/clang/Index/IndexSymbol.h vendor/clang/dist/include/clang/Index/USRGeneration.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/lib/AST/Comment.cpp vendor/clang/dist/lib/AST/CommentSema.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/DeclObjC.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.h vendor/clang/dist/lib/Driver/SanitizerArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.h vendor/clang/dist/lib/Driver/ToolChains/Linux.cpp vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Format/Format.cpp vendor/clang/dist/lib/Format/FormatToken.h vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.h vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Headers/stdatomic.h vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Index/IndexTypeSourceInfo.cpp vendor/clang/dist/lib/Index/IndexingContext.cpp vendor/clang/dist/lib/Index/IndexingContext.h vendor/clang/dist/lib/Index/USRGeneration.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaLookup.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Store.cpp vendor/clang/dist/test/Analysis/enum.cpp vendor/clang/dist/test/Analysis/gmalloc.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.cpp vendor/clang/dist/test/Analysis/uninit-const.cpp vendor/clang/dist/test/CodeGen/catch-undef-behavior.c vendor/clang/dist/test/CodeGen/pgo-sample-thinlto-summary.c vendor/clang/dist/test/CodeGen/sanitize-recover.c vendor/clang/dist/test/CodeGen/split-debug-filename.c vendor/clang/dist/test/CodeGenCXX/invariant.group-for-vptrs.cpp vendor/clang/dist/test/CodeGenCXX/ubsan-suppress-checks.cpp vendor/clang/dist/test/Driver/fsanitize.c vendor/clang/dist/test/Driver/hexagon-toolchain-elf.c vendor/clang/dist/test/Driver/linux-ld.c vendor/clang/dist/test/Driver/modules-ts.cpp vendor/clang/dist/test/Driver/sanitizer-ld.c vendor/clang/dist/test/Driver/split-debug.c vendor/clang/dist/test/Format/incomplete.cpp vendor/clang/dist/test/Headers/stdatomic.c vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Index/Core/index-source.m vendor/clang/dist/test/Index/index-refs.cpp vendor/clang/dist/test/Index/print-type.cpp vendor/clang/dist/test/Modules/Inputs/template-default-args/a.h vendor/clang/dist/test/Modules/Inputs/template-default-args/d.h vendor/clang/dist/test/Modules/localsubmodulevis.m vendor/clang/dist/test/Modules/template-default-args.cpp vendor/clang/dist/test/Parser/cxx-modules-interface.cppm vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/Sema/atomic-ops.c vendor/clang/dist/test/Sema/warn-documentation.cpp vendor/clang/dist/test/Sema/warn-documentation.m vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility.cpp vendor/clang/dist/test/SemaCXX/MicrosoftExtensions.cpp vendor/clang/dist/test/SemaCXX/modules-ts.cppm vendor/clang/dist/test/SemaObjC/unguarded-availability.m vendor/clang/dist/test/SemaOpenCL/cl20-device-side-enqueue.cl vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/clang-format/ClangFormat.cpp vendor/clang/dist/tools/clang-format/git-clang-format vendor/clang/dist/tools/libclang/CXIndexDataConsumer.cpp vendor/clang/dist/tools/libclang/CXType.cpp vendor/clang/dist/unittests/Format/CleanupTest.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/unittests/Format/FormatTestComments.cpp vendor/clang/dist/unittests/Format/FormatTestJS.cpp vendor/clang/dist/unittests/Format/FormatTestObjC.cpp vendor/clang/dist/unittests/Format/FormatTestSelective.cpp vendor/clang/dist/unittests/Format/NamespaceEndCommentsFixerTest.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake ============================================================================== --- vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 19:24:09 2017 (r317447) @@ -1,7 +1,7 @@ # This file sets up a CMakeCache for the second stage of a Fuchsia toolchain # build. -set(LLVM_TARGETS_TO_BUILD X86;AArch64 CACHE STRING "") +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") set(PACKAGE_VENDOR Fuchsia CACHE STRING "") @@ -36,6 +36,7 @@ set(BUILTINS_aarch64-fuchsia-none_CMAKE_ # Setup toolchain. set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") set(LLVM_TOOLCHAIN_TOOLS + llc llvm-ar llvm-cov llvm-cxxfilt @@ -49,6 +50,7 @@ set(LLVM_TOOLCHAIN_TOOLS llvm-readobj llvm-size llvm-symbolizer + opt CACHE STRING "") set(LLVM_DISTRIBUTION_COMPONENTS Modified: vendor/clang/dist/docs/ClangFormat.rst ============================================================================== --- vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 19:24:09 2017 (r317447) @@ -162,8 +162,9 @@ Download the latest Visual Studio extens Script for patch reformatting ============================= -The python script `clang/tools/clang-format-diff.py` parses the output of -a unified diff and reformats all contained lines with :program:`clang-format`. +The python script `clang/tools/clang-format/clang-format-diff.py` parses the +output of a unified diff and reformats all contained lines with +:program:`clang-format`. .. code-block:: console Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 19:24:09 2017 (r317447) @@ -5600,7 +5600,8 @@ typedef enum { CXIdxEntityLang_None = 0, CXIdxEntityLang_C = 1, CXIdxEntityLang_ObjC = 2, - CXIdxEntityLang_CXX = 3 + CXIdxEntityLang_CXX = 3, + CXIdxEntityLang_Swift = 4 } CXIdxEntityLanguage; /** Modified: vendor/clang/dist/include/clang/AST/CommentSema.h ============================================================================== --- vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -208,6 +208,10 @@ public: /// \returns \c true if declaration that this comment is attached to declares /// a function pointer. bool isFunctionPointerVarDecl(); + /// \returns \c true if the declaration that this comment is attached to + /// declares a variable or a field whose type is a function or a block + /// pointer. + bool isFunctionOrBlockPointerVarLikeDecl(); bool isFunctionOrMethodVariadic(); bool isObjCMethodDecl(); bool isObjCPropertyDecl(); Modified: vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h ============================================================================== --- vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1406,7 +1406,7 @@ const internal::VariadicDynCastAllOfMatc /// /// Example: Given /// \code -/// struct T {void func()}; +/// struct T {void func();}; /// T f(); /// void g(T); /// \endcode Modified: vendor/clang/dist/include/clang/Basic/Diagnostic.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 19:24:09 2017 (r317447) @@ -12,6 +12,8 @@ // //===----------------------------------------------------------------------===// +// See the Internals Manual, section The Diagnostics Subsystem for an overview. + // Define the diagnostic severities. class Severity { string Name = N; @@ -100,10 +102,20 @@ class SuppressInSystemHeader { class Error : Diagnostic, SFINAEFailure { bit ShowInSystemHeader = 1; } +// Warnings default to on (but can be default-off'd with DefaultIgnore). +// This is used for warnings about questionable code; warnings about +// accepted language extensions should use Extension or ExtWarn below instead. class Warning : Diagnostic; +// Remarks can be turned on with -R flags and provide commentary, e.g. on +// optimizer decisions. class Remark : Diagnostic; +// Extensions are warnings about accepted language extensions. +// Extension warnings are default-off but enabled by -pedantic. class Extension : Diagnostic; +// ExtWarns are warnings about accepted language extensions. +// ExtWarn warnings are default-on. class ExtWarn : Diagnostic; +// Notes can provide supplementary information on errors, warnings, and remarks. class Note : Diagnostic; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -1114,14 +1114,12 @@ def err_pragma_cannot_end_force_cuda_hos } // end of Parse Issue category. let CategoryName = "Modules Issue" in { -def err_expected_module_interface_decl : Error< - "expected module declaration at start of module interface">; def err_unexpected_module_decl : Error< - "module declaration must be the first declaration in the translation unit">; + "module declaration can only appear at the top level">; def err_module_expected_ident : Error< - "expected a module name after module%select{| import}0">; -def err_unexpected_module_kind : Error< - "unexpected module kind %0; expected 'implementation' or 'partition'">; + "expected a module name after '%select{module|import}0'">; +def err_module_implementation_partition : Error< + "module partition must be declared 'export'">; def err_attribute_not_module_attr : Error< "%0 attribute cannot be applied to a module">; def err_attribute_not_import_attr : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -8801,9 +8801,11 @@ def err_invalid_type_for_program_scope_v } let CategoryName = "Modules Issue" in { +def err_module_decl_in_module_map_module : Error< + "'module' declaration found while building module from module map">; def err_module_interface_implementation_mismatch : Error< - "%select{'module'|'module partition'|'module implementation'}0 declaration " - "found while %select{not |not |}0building module interface">; + "missing 'export' specifier in module declaration while " + "building module interface">; def err_current_module_name_mismatch : Error< "module name '%0' specified on command line does not match name of module">; def err_module_redefinition : Error< @@ -8846,8 +8848,13 @@ def err_module_self_import : Error< "import of module '%0' appears within same top-level module '%1'">; def err_module_import_in_implementation : Error< "@import of module '%0' in implementation of '%1'; use #import">; + +// C++ Modules TS def err_export_within_export : Error< "export declaration appears within another export declaration">; +def err_export_not_in_module_interface : Error< + "export declaration can only be used within a module interface unit after " + "the module declaration">; def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn< "ambiguous use of internal linkage declaration %0 defined in multiple modules">, Modified: vendor/clang/dist/include/clang/Basic/Module.h ============================================================================== --- vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 19:24:09 2017 (r317447) @@ -62,6 +62,18 @@ public: /// \brief The location of the module definition. SourceLocation DefinitionLoc; + enum ModuleKind { + /// \brief This is a module that was defined by a module map and built out + /// of header files. + ModuleMapModule, + + /// \brief This is a C++ Modules TS module interface unit. + ModuleInterfaceUnit + }; + + /// \brief The kind of this module. + ModuleKind Kind = ModuleMapModule; + /// \brief The parent of this module. This will be NULL for the top-level /// module. Module *Parent; Modified: vendor/clang/dist/include/clang/Basic/Sanitizers.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 19:24:09 2017 (r317447) @@ -47,6 +47,9 @@ SANITIZER("kernel-address", KernelAddres // MemorySanitizer SANITIZER("memory", Memory) +// libFuzzer +SANITIZER("fuzzer", Fuzzer) + // ThreadSanitizer SANITIZER("thread", Thread) Modified: vendor/clang/dist/include/clang/Driver/CC1Options.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 19:24:09 2017 (r317447) @@ -573,6 +573,8 @@ def fblocks_runtime_optional : Flag<["-" HelpText<"Weakly link in the blocks runtime">; def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">, HelpText<"Assume all functions with C linkage do not unwind">; +def enable_split_dwarf : Flag<["-"], "enable-split-dwarf">, + HelpText<"Use split dwarf/Fission">; def split_dwarf_file : Separate<["-"], "split-dwarf-file">, HelpText<"File name to use for split dwarf debug info output">; def fno_wchar : Flag<["-"], "fno-wchar">, Modified: vendor/clang/dist/include/clang/Driver/SanitizerArgs.h ============================================================================== --- vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 19:24:09 2017 (r317447) @@ -50,6 +50,7 @@ class SanitizerArgs { bool needsSharedAsanRt() const { return AsanSharedRuntime; } bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); } bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); } + bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); } bool needsLsanRt() const { return Sanitizers.has(SanitizerKind::Leak) && !Sanitizers.has(SanitizerKind::Address); Modified: vendor/clang/dist/include/clang/Format/Format.h ============================================================================== --- vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1512,6 +1512,18 @@ llvm::Expected cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); +/// \brief Represents the status of a formatting attempt. +struct FormattingAttemptStatus { + /// \brief A value of ``false`` means that any of the affected ranges were not + /// formatted due to a non-recoverable syntax error. + bool FormatComplete = true; + + /// \brief If ``FormatComplete`` is false, ``Line`` records a one-based + /// original line number at which a syntax error might have occurred. This is + /// based on a best-effort analysis and could be imprecise. + unsigned Line = 0; +}; + /// \brief Reformats the given \p Ranges in \p Code. /// /// Each range is extended on either end to its next bigger logic unit, i.e. @@ -1521,13 +1533,20 @@ cleanupAroundReplacements(StringRef Code /// Returns the ``Replacements`` necessary to make all \p Ranges comply with /// \p Style. /// -/// If ``IncompleteFormat`` is non-null, its value will be set to true if any -/// of the affected ranges were not formatted due to a non-recoverable syntax -/// error. +/// If ``Status`` is non-null, its value will be populated with the status of +/// this formatting attempt. See \c FormattingAttemptStatus. tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef Ranges, StringRef FileName = "", - bool *IncompleteFormat = nullptr); + FormattingAttemptStatus *Status = nullptr); + +/// \brief Same as above, except if ``IncompleteFormat`` is non-null, its value +/// will be set to true if any of the affected ranges were not formatted due to +/// a non-recoverable syntax error. +tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, + ArrayRef Ranges, + StringRef FileName, + bool *IncompleteFormat); /// \brief Clean up any erroneous/redundant code in the given \p Ranges in \p /// Code. Modified: vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def ============================================================================== --- vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 19:24:09 2017 (r317447) @@ -199,6 +199,7 @@ CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should ///< contain explicit imports for ///< anonymous namespaces +CODEGENOPT(EnableSplitDwarf, 1, 0) ///< Whether to enable split DWARF CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the ///< skeleton CU to allow for symbolication ///< of inline stack frames without .dwo files. Modified: vendor/clang/dist/include/clang/Index/IndexSymbol.h ============================================================================== --- vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 19:24:09 2017 (r317447) @@ -59,6 +59,7 @@ enum class SymbolLanguage { C, ObjC, CXX, + Swift, }; /// Language specific sub-kinds. Modified: vendor/clang/dist/include/clang/Index/USRGeneration.h ============================================================================== --- vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 19:24:09 2017 (r317447) @@ -30,10 +30,14 @@ static inline StringRef getUSRSpacePrefi bool generateUSRForDecl(const Decl *D, SmallVectorImpl &Buf); /// \brief Generate a USR fragment for an Objective-C class. -void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS); +void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = "", + StringRef CategoryContextExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C class category. -void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS); +void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, + StringRef ClsExtSymbolDefinedIn = "", + StringRef CatExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C instance variable. The /// complete USR can be created by concatenating the USR for the @@ -48,7 +52,15 @@ void generateUSRForObjCMethod(StringRef void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS); /// \brief Generate a USR fragment for an Objective-C protocol. -void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS); +void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate USR fragment for a global (non-nested) enum. +void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an enum constant. +void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS); /// \brief Generate a USR for a macro, including the USR prefix. /// Modified: vendor/clang/dist/include/clang/Sema/Sema.h ============================================================================== --- vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1934,7 +1934,8 @@ public: /// The parser has processed a module-declaration that begins the definition /// of a module interface or implementation. - DeclGroupPtrTy ActOnModuleDecl(SourceLocation ModuleLoc, ModuleDeclKind MDK, + DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, + SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path); /// \brief The parser has processed a module import declaration. @@ -8326,6 +8327,12 @@ private: /// Returns OpenMP nesting level for current directive. unsigned getOpenMPNestingLevel() const; + /// Push new OpenMP function region for non-capturing function. + void pushOpenMPFunctionRegion(); + + /// Pop OpenMP function region for non-capturing function. + void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI); + /// Checks if a type or a declaration is disabled due to the owning extension /// being disabled, and emits diagnostic messages if it is disabled. /// \param D type or declaration to be checked. Modified: vendor/clang/dist/lib/AST/Comment.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -116,6 +116,9 @@ bool ParagraphComment::isWhitespaceNoCac static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc &SrcTL) { TypeLoc TL = SrcTL.IgnoreParens(); + // Look through attribute types. + if (AttributedTypeLoc AttributeTL = TL.getAs()) + return AttributeTL.getModifiedLoc(); // Look through qualified types. if (QualifiedTypeLoc QualifiedTL = TL.getAs()) return QualifiedTL.getUnqualifiedLoc(); @@ -280,8 +283,25 @@ void DeclInfo::fill() { case Decl::EnumConstant: case Decl::ObjCIvar: case Decl::ObjCAtDefsField: + case Decl::ObjCProperty: { + const TypeSourceInfo *TSI; + if (const auto *VD = dyn_cast(CommentDecl)) + TSI = VD->getTypeSourceInfo(); + else if (const auto *PD = dyn_cast(CommentDecl)) + TSI = PD->getTypeSourceInfo(); + else + TSI = nullptr; + if (TSI) { + TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc(); + FunctionTypeLoc FTL; + if (getFunctionTypeLoc(TL, FTL)) { + ParamVars = FTL.getParams(); + ReturnType = FTL.getReturnLoc().getType(); + } + } Kind = VariableKind; break; + } case Decl::Namespace: Kind = NamespaceKind; break; Modified: vendor/clang/dist/lib/AST/CommentSema.cpp ============================================================================== --- vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -86,7 +86,7 @@ ParamCommandComment *Sema::actOnParamCom new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID, CommandMarker); - if (!isFunctionDecl()) + if (!isFunctionDecl() && !isFunctionOrBlockPointerVarLikeDecl()) Diag(Command->getLocation(), diag::warn_doc_param_not_attached_to_a_function_decl) << CommandMarker @@ -584,7 +584,11 @@ void Sema::checkReturnsCommand(const Blo assert(ThisDeclInfo && "should not call this check on a bare comment"); - if (isFunctionDecl()) { + // We allow the return command for all @properties because it can be used + // to document the value that the property getter returns. + if (isObjCPropertyDecl()) + return; + if (isFunctionDecl() || isFunctionOrBlockPointerVarLikeDecl()) { if (ThisDeclInfo->ReturnType->isVoidType()) { unsigned DiagKind; switch (ThisDeclInfo->CommentDecl->getKind()) { @@ -610,8 +614,6 @@ void Sema::checkReturnsCommand(const Blo } return; } - else if (isObjCPropertyDecl()) - return; Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) @@ -844,6 +846,30 @@ bool Sema::isFunctionPointerVarDecl() { return false; } +bool Sema::isFunctionOrBlockPointerVarLikeDecl() { + if (!ThisDeclInfo) + return false; + if (!ThisDeclInfo->IsFilled) + inspectThisDecl(); + if (ThisDeclInfo->getKind() != DeclInfo::VariableKind || + !ThisDeclInfo->CurrentDecl) + return false; + QualType QT; + if (const auto *VD = dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = VD->getType(); + else if (const auto *PD = + dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = PD->getType(); + else + return false; + // We would like to warn about the 'returns'/'param' commands for + // variables that don't directly specify the function type, so type aliases + // can be ignored. + if (QT->getAs()) + return false; + return QT->isFunctionPointerType() || QT->isBlockPointerType(); +} + bool Sema::isObjCPropertyDecl() { if (!ThisDeclInfo) return false; Modified: vendor/clang/dist/lib/AST/Decl.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2251,6 +2251,14 @@ bool VarDecl::checkInitIsICE() const { return Eval->IsICE; } +template +static DeclT *getDefinitionOrSelf(DeclT *D) { + assert(D); + if (auto *Def = D->getDefinition()) + return Def; + return D; +} + VarDecl *VarDecl::getTemplateInstantiationPattern() const { // If it's a variable template specialization, find the template or partial // specialization from which it was instantiated. @@ -2262,7 +2270,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTD = NewVTD; } - return VTD->getTemplatedDecl()->getDefinition(); + return getDefinitionOrSelf(VTD->getTemplatedDecl()); } if (auto *VTPSD = From.dyn_cast()) { @@ -2271,7 +2279,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTPSD = NewVTPSD; } - return VTPSD->getDefinition(); + return getDefinitionOrSelf(VTPSD); } } @@ -2280,23 +2288,18 @@ VarDecl *VarDecl::getTemplateInstantiati VarDecl *VD = getInstantiatedFromStaticDataMember(); while (auto *NewVD = VD->getInstantiatedFromStaticDataMember()) VD = NewVD; - return VD->getDefinition(); + return getDefinitionOrSelf(VD); } } if (VarTemplateDecl *VarTemplate = getDescribedVarTemplate()) { - while (VarTemplate->getInstantiatedFromMemberTemplate()) { if (VarTemplate->isMemberSpecialization()) break; VarTemplate = VarTemplate->getInstantiatedFromMemberTemplate(); } - assert((!VarTemplate->getTemplatedDecl() || - !isTemplateInstantiation(getTemplateSpecializationKind())) && - "couldn't find pattern for variable instantiation"); - - return VarTemplate->getTemplatedDecl(); + return getDefinitionOrSelf(VarTemplate->getTemplatedDecl()); } return nullptr; } @@ -3198,9 +3201,12 @@ bool FunctionDecl::isTemplateInstantiati FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { // Handle class scope explicit specialization special case. - if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) - return getClassScopeSpecializationPattern(); - + if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { + if (auto *Spec = getClassScopeSpecializationPattern()) + return getDefinitionOrSelf(Spec); + return nullptr; + } + // If this is a generic lambda call operator specialization, its // instantiation pattern is always its primary template's pattern // even if its primary template was instantiated from another @@ -3212,16 +3218,10 @@ FunctionDecl *FunctionDecl::getTemplateI if (isGenericLambdaCallOperatorSpecialization( dyn_cast(this))) { - assert(getPrimaryTemplate() && "A generic lambda specialization must be " - "generated from a primary call operator " - "template"); - assert(getPrimaryTemplate()->getTemplatedDecl()->getBody() && - "A generic lambda call operator template must always have a body - " - "even if instantiated from a prototype (i.e. as written) member " - "template"); - return getPrimaryTemplate()->getTemplatedDecl(); + assert(getPrimaryTemplate() && "not a generic lambda call operator?"); + return getDefinitionOrSelf(getPrimaryTemplate()->getTemplatedDecl()); } - + if (FunctionTemplateDecl *Primary = getPrimaryTemplate()) { while (Primary->getInstantiatedFromMemberTemplate()) { // If we have hit a point where the user provided a specialization of @@ -3230,11 +3230,14 @@ FunctionDecl *FunctionDecl::getTemplateI break; Primary = Primary->getInstantiatedFromMemberTemplate(); } - - return Primary->getTemplatedDecl(); + + return getDefinitionOrSelf(Primary->getTemplatedDecl()); } - - return getInstantiatedFromMemberFunction(); + + if (auto *MFD = getInstantiatedFromMemberFunction()) + return getDefinitionOrSelf(MFD); + + return nullptr; } FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { @@ -3778,7 +3781,7 @@ EnumDecl *EnumDecl::getTemplateInstantia EnumDecl *ED = getInstantiatedFromMemberEnum(); while (auto *NewED = ED->getInstantiatedFromMemberEnum()) ED = NewED; - return ED; + return getDefinitionOrSelf(ED); } } Modified: vendor/clang/dist/lib/AST/DeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -1364,6 +1364,13 @@ CXXRecordDecl::setTemplateSpecialization } const CXXRecordDecl *CXXRecordDecl::getTemplateInstantiationPattern() const { + auto GetDefinitionOrSelf = + [](const CXXRecordDecl *D) -> const CXXRecordDecl * { + if (auto *Def = D->getDefinition()) + return Def; + return D; + }; + // If it's a class template specialization, find the template or partial // specialization from which it was instantiated. if (auto *TD = dyn_cast(this)) { @@ -1374,7 +1381,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTD = NewCTD; } - return CTD->getTemplatedDecl()->getDefinition(); + return GetDefinitionOrSelf(CTD->getTemplatedDecl()); } if (auto *CTPSD = From.dyn_cast()) { @@ -1383,7 +1390,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTPSD = NewCTPSD; } - return CTPSD->getDefinition(); + return GetDefinitionOrSelf(CTPSD); } } @@ -1392,7 +1399,7 @@ const CXXRecordDecl *CXXRecordDecl::getT const CXXRecordDecl *RD = this; while (auto *NewRD = RD->getInstantiatedFromMemberClass()) RD = NewRD; - return RD->getDefinition(); + return GetDefinitionOrSelf(RD); } } Modified: vendor/clang/dist/lib/AST/DeclObjC.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -539,9 +539,18 @@ void ObjCInterfaceDecl::getDesignatedIni bool ObjCInterfaceDecl::isDesignatedInitializer(Selector Sel, const ObjCMethodDecl **InitMethod) const { + bool HasCompleteDef = isThisDeclarationADefinition(); + // During deserialization the data record for the ObjCInterfaceDecl could + // be made invariant by reusing the canonical decl. Take this into account + // when checking for the complete definition. + if (!HasCompleteDef && getCanonicalDecl()->hasDefinition() && + getCanonicalDecl()->getDefinition() == getDefinition()) + HasCompleteDef = true; + // Check for a complete definition and recover if not so. - if (!isThisDeclarationADefinition()) + if (!HasCompleteDef) return false; + if (data().ExternallyCompleted) LoadExternalDefinition(); Modified: vendor/clang/dist/lib/CodeGen/BackendUtil.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -129,16 +129,20 @@ public: // that we add to the PassManagerBuilder. class PassManagerBuilderWrapper : public PassManagerBuilder { public: - PassManagerBuilderWrapper(const CodeGenOptions &CGOpts, + PassManagerBuilderWrapper(const Triple &TargetTriple, + const CodeGenOptions &CGOpts, const LangOptions &LangOpts) - : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {} + : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts), + LangOpts(LangOpts) {} + const Triple &getTargetTriple() const { return TargetTriple; } const CodeGenOptions &getCGOpts() const { return CGOpts; } const LangOptions &getLangOpts() const { return LangOpts; } + private: + const Triple &TargetTriple; const CodeGenOptions &CGOpts; const LangOptions &LangOpts; }; - } static void addObjCARCAPElimPass(const PassManagerBuilder &Builder, PassManagerBase &PM) { @@ -185,16 +189,35 @@ static void addSanitizerCoveragePass(con PM.add(createSanitizerCoverageModulePass(Opts)); } +// Check if ASan should use GC-friendly instrumentation for globals. +// First of all, there is no point if -fdata-sections is off (expect for MachO, +// where this is not a factor). Also, on ELF this feature requires an assembler +// extension that only works with -integrated-as at the moment. +static bool asanUseGlobalsGC(const Triple &T, const CodeGenOptions &CGOpts) { + switch (T.getObjectFormat()) { + case Triple::MachO: + case Triple::COFF: + return true; + case Triple::ELF: + return CGOpts.DataSections && !CGOpts.DisableIntegratedAS; + default: + return false; + } +} + static void addAddressSanitizerPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { const PassManagerBuilderWrapper &BuilderWrapper = static_cast(Builder); + const Triple &T = BuilderWrapper.getTargetTriple(); const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts(); bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Address); bool UseAfterScope = CGOpts.SanitizeAddressUseAfterScope; + bool UseGlobalsGC = asanUseGlobalsGC(T, CGOpts); PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/ false, Recover, UseAfterScope)); - PM.add(createAddressSanitizerModulePass(/*CompileKernel*/false, Recover)); + PM.add(createAddressSanitizerModulePass(/*CompileKernel*/ false, Recover, + UseGlobalsGC)); } static void addKernelAddressSanitizerPasses(const PassManagerBuilder &Builder, @@ -407,6 +430,8 @@ static void initTargetOptions(llvm::Targ Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); + if (CodeGenOpts.EnableSplitDwarf) + Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile; Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm; @@ -434,8 +459,6 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.DisableLLVMPasses) return; - PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) // are inserted before PMBuilder ones - they'd get the default-constructed @@ -444,6 +467,8 @@ void EmitAssemblyHelper::CreatePasses(le std::unique_ptr TLII( createTLII(TargetTriple, CodeGenOpts)); + PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts); + // At O0 and O1 we only run the always inliner which is more efficient. At // higher optimization levels we run the normal inliner. if (CodeGenOpts.OptimizationLevel <= 1) { Modified: vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -528,12 +528,14 @@ void CGDebugInfo::CreateCompileUnit() { // Create new compile unit. // FIXME - Eliminate TheCU. TheCU = DBuilder.createCompileUnit( - LangTag, DBuilder.createFile(remapDIPath(MainFileName), - remapDIPath(getCurrentDirname()), CSKind, - Checksum), + LangTag, + DBuilder.createFile(remapDIPath(MainFileName), + remapDIPath(getCurrentDirname()), CSKind, Checksum), Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, - CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */, - CGM.getCodeGenOpts().SplitDwarfInlining, + CGM.getCodeGenOpts().EnableSplitDwarf + ? "" + : CGM.getCodeGenOpts().SplitDwarfFile, + EmissionKind, 0 /* DWOid */, CGM.getCodeGenOpts().SplitDwarfInlining, CGM.getCodeGenOpts().DebugInfoForProfiling); } Modified: vendor/clang/dist/lib/CodeGen/CGExpr.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -533,15 +533,6 @@ bool CodeGenFunction::sanitizePerformTyp SanOpts.has(SanitizerKind::Vptr); } -/// Check if a runtime null check for \p Ptr can be omitted. -static bool canOmitPointerNullCheck(llvm::Value *Ptr) { - // Note: do not perform any constant-folding in this function. That is best - // left to the IR builder. - - // Pointers to alloca'd memory are non-null. - return isa(Ptr->stripPointerCastsNoFollowAliases()); -} - void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *Ptr, QualType Ty, CharUnits Alignment, @@ -560,11 +551,16 @@ void CodeGenFunction::EmitTypeCheck(Type SmallVector, 3> Checks; llvm::BasicBlock *Done = nullptr; + // Quickly determine whether we have a pointer to an alloca. It's possible + // to skip null checks, and some alignment checks, for these pointers. This + // can reduce compile-time significantly. + auto PtrToAlloca = + dyn_cast(Ptr->stripPointerCastsNoFollowAliases()); + bool AllowNullPointers = TCK == TCK_DowncastPointer || TCK == TCK_Upcast || TCK == TCK_UpcastToVirtualBase; if ((SanOpts.has(SanitizerKind::Null) || AllowNullPointers) && - !SkippedChecks.has(SanitizerKind::Null) && - !canOmitPointerNullCheck(Ptr)) { + !SkippedChecks.has(SanitizerKind::Null) && !PtrToAlloca) { // The glvalue must not be an empty glvalue. llvm::Value *IsNonNull = Builder.CreateIsNotNull(Ptr); @@ -617,7 +613,8 @@ void CodeGenFunction::EmitTypeCheck(Type AlignVal = getContext().getTypeAlignInChars(Ty).getQuantity(); // The glvalue must be suitably aligned. - if (AlignVal > 1) { + if (AlignVal > 1 && + (!PtrToAlloca || PtrToAlloca->getAlignment() < AlignVal)) { llvm::Value *Align = Builder.CreateAnd(Builder.CreatePtrToInt(Ptr, IntPtrTy), llvm::ConstantInt::get(IntPtrTy, AlignVal - 1)); Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2466,16 +2466,14 @@ static int addMonoNonMonoModifier(OpenMP return Schedule | Modifier; } -void CGOpenMPRuntime::emitForDispatchInit(CodeGenFunction &CGF, - SourceLocation Loc, - const OpenMPScheduleTy &ScheduleKind, - unsigned IVSize, bool IVSigned, - bool Ordered, llvm::Value *UB, - llvm::Value *Chunk) { +void CGOpenMPRuntime::emitForDispatchInit( + CodeGenFunction &CGF, SourceLocation Loc, + const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, + bool Ordered, const DispatchRTInput &DispatchValues) { if (!CGF.HaveInsertPoint()) return; - OpenMPSchedType Schedule = - getRuntimeSchedule(ScheduleKind.Schedule, Chunk != nullptr, Ordered); + OpenMPSchedType Schedule = getRuntimeSchedule( + ScheduleKind.Schedule, DispatchValues.Chunk != nullptr, Ordered); assert(Ordered || (Schedule != OMP_sch_static && Schedule != OMP_sch_static_chunked && Schedule != OMP_ord_static && Schedule != OMP_ord_static_chunked && @@ -2486,14 +2484,14 @@ void CGOpenMPRuntime::emitForDispatchIni // kmp_int[32|64] stride, kmp_int[32|64] chunk); // If the Chunk was not specified in the clause - use default value 1. - if (Chunk == nullptr) - Chunk = CGF.Builder.getIntN(IVSize, 1); + llvm::Value *Chunk = DispatchValues.Chunk ? DispatchValues.Chunk + : CGF.Builder.getIntN(IVSize, 1); llvm::Value *Args[] = { emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc), CGF.Builder.getInt32(addMonoNonMonoModifier( Schedule, ScheduleKind.M1, ScheduleKind.M2)), // Schedule type - CGF.Builder.getIntN(IVSize, 0), // Lower - UB, // Upper + DispatchValues.LB, // Lower + DispatchValues.UB, // Upper CGF.Builder.getIntN(IVSize, 1), // Stride Chunk // Chunk }; Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 19:24:09 2017 (r317447) @@ -672,16 +672,50 @@ public: /// virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const; + /// struct with the values to be passed to the dispatch runtime function + struct DispatchRTInput { + /// Loop lower bound + llvm::Value *LB = nullptr; + /// Loop upper bound + llvm::Value *UB = nullptr; + /// Chunk size specified using 'schedule' clause (nullptr if chunk + /// was not specified) + llvm::Value *Chunk = nullptr; + DispatchRTInput() = default; + DispatchRTInput(llvm::Value *LB, llvm::Value *UB, llvm::Value *Chunk) + : LB(LB), UB(UB), Chunk(Chunk) {} + }; + + /// Call the appropriate runtime routine to initialize it before start + /// of loop. + + /// This is used for non static scheduled types and when the ordered + /// clause is present on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime + /// routine before start of the OpenMP loop to get the loop upper / lower + /// bounds \a LB and \a UB and stride \a ST. + /// + /// \param CGF Reference to current CodeGenFunction. + /// \param Loc Clang source location. + /// \param ScheduleKind Schedule kind, specified by the 'schedule' clause. + /// \param IVSize Size of the iteration variable in bits. + /// \param IVSigned Sign of the interation variable. + /// \param Ordered true if loop is ordered, false otherwise. + /// \param DispatchValues struct containing llvm values for lower bound, upper + /// bound, and chunk expression. + /// For the default (nullptr) value, the chunk 1 will be used. + /// virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, - llvm::Value *UB, - llvm::Value *Chunk = nullptr); + const DispatchRTInput &DispatchValues); /// \brief Call the appropriate runtime routine to initialize it before start /// of loop. /// - /// Depending on the loop schedule, it is nesessary to call some runtime + /// This is used only in case of static schedule, when the user did not + /// specify a ordered clause on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime /// routine before start of the OpenMP loop to get the loop upper / lower /// bounds \a LB and \a UB and stride \a ST. /// Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -87,7 +87,8 @@ public: class OMPParallelScope final : public OMPLexicalScope { bool EmitPreInitStmt(const OMPExecutableDirective &S) { OpenMPDirectiveKind Kind = S.getDirectiveKind(); - return !isOpenMPTargetExecutionDirective(Kind) && + return !(isOpenMPTargetExecutionDirective(Kind) || + isOpenMPLoopBoundSharingDirective(Kind)) && isOpenMPParallelDirective(Kind); } @@ -1249,10 +1250,20 @@ static void emitPostUpdateForReductionCl CGF.EmitBlock(DoneBB, /*IsFinished=*/true); } -static void emitCommonOMPParallelDirective(CodeGenFunction &CGF, - const OMPExecutableDirective &S, - OpenMPDirectiveKind InnermostKind, - const RegionCodeGenTy &CodeGen) { +namespace { +/// Codegen lambda for appending distribute lower and upper bounds to outlined +/// parallel function. This is necessary for combined constructs such as +/// 'distribute parallel for' +typedef llvm::function_ref &)> + CodeGenBoundParametersTy; +} // anonymous namespace + +static void emitCommonOMPParallelDirective( + CodeGenFunction &CGF, const OMPExecutableDirective &S, + OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, + const CodeGenBoundParametersTy &CodeGenBoundParameters) { const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel); auto OutlinedFn = CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction( S, *CS->getCapturedDecl()->param_begin(), InnermostKind, CodeGen); @@ -1279,11 +1290,20 @@ static void emitCommonOMPParallelDirecti OMPParallelScope Scope(CGF, S); llvm::SmallVector CapturedVars; + // Combining 'distribute' with 'for' requires sharing each 'distribute' chunk + // lower and upper bounds with the pragma 'for' chunking mechanism. + // The following lambda takes care of appending the lower and upper bound + // parameters when necessary + CodeGenBoundParameters(CGF, S, CapturedVars); CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getLocStart(), OutlinedFn, CapturedVars, IfCond); } +static void emitEmptyBoundParameters(CodeGenFunction &, + const OMPExecutableDirective &, + llvm::SmallVectorImpl &) {} + void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { // Emit parallel region as a standalone region. auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { @@ -1304,7 +1324,8 @@ void CodeGenFunction::EmitOMPParallelDir CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt()); CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_parallel); }; - emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen); + emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen, + emitEmptyBoundParameters); emitPostUpdateForReductionClause( *this, S, [](CodeGenFunction &) -> llvm::Value * { return nullptr; }); } @@ -1649,6 +1670,13 @@ void CodeGenFunction::EmitOMPSimdFinal( EmitBlock(DoneBB, /*IsFinished=*/true); } +static void emitOMPLoopBodyWithStopPoint(CodeGenFunction &CGF, + const OMPLoopDirective &S, + CodeGenFunction::JumpDest LoopExit) { + CGF.EmitOMPLoopBody(S, LoopExit); + CGF.EmitStopPoint(&S); +}; + void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { OMPLoopScope PreInitScope(CGF, S); @@ -1731,9 +1759,12 @@ void CodeGenFunction::EmitOMPSimdDirecti CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen); } -void CodeGenFunction::EmitOMPOuterLoop(bool DynamicOrOrdered, bool IsMonotonic, - const OMPLoopDirective &S, OMPPrivateScope &LoopScope, bool Ordered, - Address LB, Address UB, Address ST, Address IL, llvm::Value *Chunk) { +void CodeGenFunction::EmitOMPOuterLoop( + bool DynamicOrOrdered, bool IsMonotonic, const OMPLoopDirective &S, + CodeGenFunction::OMPPrivateScope &LoopScope, + const CodeGenFunction::OMPLoopArguments &LoopArgs, + const CodeGenFunction::CodeGenLoopTy &CodeGenLoop, + const CodeGenFunction::CodeGenOrderedTy &CodeGenOrdered) { auto &RT = CGM.getOpenMPRuntime(); const Expr *IVExpr = S.getIterationVariable(); @@ -1751,15 +1782,18 @@ void CodeGenFunction::EmitOMPOuterLoop(b llvm::Value *BoolCondVal = nullptr; if (!DynamicOrOrdered) { - // UB = min(UB, GlobalUB) - EmitIgnoredExpr(S.getEnsureUpperBound()); + // UB = min(UB, GlobalUB) or + // UB = min(UB, PrevUB) for combined loop sharing constructs (e.g. + // 'distribute parallel for') + EmitIgnoredExpr(LoopArgs.EUB); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***