From owner-svn-src-all@freebsd.org Sat Feb 25 14:40:44 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 684E1CED858; Sat, 25 Feb 2017 14:40:44 +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 2B1C4255; Sat, 25 Feb 2017 14:40:44 +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 v1PEehIp087094; Sat, 25 Feb 2017 14:40:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1PEegEb087087; Sat, 25 Feb 2017 14:40:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201702251440.v1PEegEb087087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 25 Feb 2017 14:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r314260 - in vendor/clang/dist: docs lib/CodeGen lib/Frontend lib/StaticAnalyzer/Checkers test/Analysis test/OpenMP test/Sema 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: Sat, 25 Feb 2017 14:40:44 -0000 Author: dim Date: Sat Feb 25 14:40:42 2017 New Revision: 314260 URL: https://svnweb.freebsd.org/changeset/base/314260 Log: Vendor import of clang release_40 branch r296202: https://llvm.org/svn/llvm-project/cfe/branches/release_40@296202 Modified: vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp vendor/clang/dist/test/Analysis/virtualcall.cpp vendor/clang/dist/test/OpenMP/cancellation_point_codegen.cpp vendor/clang/dist/test/Sema/atomic-ops.c Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 25 14:40:42 2017 (r314260) @@ -1,6 +1,6 @@ -======================================= -Clang 4.0.0 (In-Progress) Release Notes -======================================= +========================= +Clang 4.0.0 Release Notes +========================= .. contents:: :local: @@ -8,12 +8,6 @@ Clang 4.0.0 (In-Progress) Release Notes Written by the `LLVM Team `_ -.. warning:: - - These are in-progress notes for the upcoming Clang 4.0.0 release. You may - prefer the `Clang 3.9 Release Notes - `_. - Introduction ============ @@ -42,7 +36,8 @@ sections with improvements to Clang's su Major New Features ------------------ -- The ``diagnose_if`` attribute has been added to clang. This attribute allows +- The `diagnose_if `_ attribute has been + added to clang. This attribute allows clang to emit a warning or error if a function call meets one or more user-specified conditions. @@ -65,76 +60,24 @@ Major New Features } -- ... - Improvements to ThinLTO (-flto=thin) ------------------------------------ - Integration with profile data (PGO). When available, profile data enables more accurate function importing decisions, as well as cross-module indirect call promotion. - Significant build-time and binary-size improvements when compiling with debug - info (-g). - -Improvements to Clang's diagnostics -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- ... + info (``-g``). New Compiler Flags ------------------ -The option -Og has been added to optimize the debugging experience. -For now, this option is exactly the same as -O1. However, in the future, -some other optimizations might be enabled or disabled. - -The option -MJ has been added to simplify adding JSON compilation -database output into existing build systems. - -The option .... - -New Pragmas in Clang ------------------------ - -Clang now supports the ... - - -Attribute Changes in Clang --------------------------- - -- ... - -Windows Support ---------------- - -Clang's support for building native Windows programs ... - - -C Language Changes in Clang ---------------------------- - -- ... - -... - -C11 Feature Support -^^^^^^^^^^^^^^^^^^^ - -... +- The option ``-Og`` has been added to optimize the debugging experience. + For now, this option is exactly the same as ``-O1``. However, in the future, + some other optimizations might be enabled or disabled. -C++ Language Changes in Clang ------------------------------ +- The option ``-MJ`` has been added to simplify adding JSON compilation + database output into existing build systems. -... - -C++1z Feature Support -^^^^^^^^^^^^^^^^^^^^^ - -... - -Objective-C Language Changes in Clang -------------------------------------- - -... OpenCL C Language Changes in Clang ---------------------------------- @@ -206,42 +149,14 @@ OpenCL C Language Changes in Clang which is now handled as a compiler builtin function with an integer value passed into it. * Change fake address space map to use the SPIR convention. -* Added `the OpenCL manual - `_ to Clang +* Added `the OpenCL manual `_ to Clang documentation. -OpenMP Support in Clang ----------------------------------- - -... - -Internal API Changes --------------------- - -These are major API changes that have happened since the 3.9 release of -Clang. If upgrading an external codebase that uses Clang as a library, -this section should help get you past the largest hurdles of upgrading. - -- ... - -AST Matchers ------------- - -... - -libclang --------- - -... - -With the option --show-description, scan-build's list of defects will also -show the description of the defects. - Static Analyzer --------------- -With the option --show-description, scan-build's list of defects will also +With the option ``--show-description``, scan-build's list of defects will also show the description of the defects. The analyzer now provides better support of code that uses gtest. @@ -250,29 +165,19 @@ Several new checks were added: - The analyzer warns when virtual calls are made from constructors or destructors. This check is off by default but can be enabled by passing the - following command to scan-build: -enable-checker optin.cplusplus.VirtualCall. + following command to scan-build: ``-enable-checker optin.cplusplus.VirtualCall``. - The analyzer checks for synthesized copy properties of mutable types in - Objective C, such as NSMutableArray. Calling the setter for these properties + Objective C, such as ``NSMutableArray``. Calling the setter for these properties will store an immutable copy of the value. -- The analyzer checks for calls to dispatch_once() that use an Objective-C +- The analyzer checks for calls to ``dispatch_once()`` that use an Objective-C instance variable as the predicate. Using an instance variable as a predicate may result in the passed-in block being executed multiple times or not at all. These calls should be rewritten either to use a lock or to store the predicate in a global or static variable. -- The analyzer checks for unintended comparisons of NSNumber, CFNumberRef, and +- The analyzer checks for unintended comparisons of ``NSNumber``, ``CFNumberRef``, and other Cocoa number objects to scalar values. -Python Binding Changes ----------------------- - -The following methods have been added: - -- ... - -Significant Known Problems -========================== - Additional Information ====================== Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Sat Feb 25 14:40:42 2017 (r314260) @@ -4697,7 +4697,9 @@ void CGOpenMPRuntime::emitCancellationPo // global_tid, kmp_int32 cncl_kind); if (auto *OMPRegionInfo = dyn_cast_or_null(CGF.CapturedStmtInfo)) { - if (OMPRegionInfo->hasCancel()) { + // For 'cancellation point taskgroup', the task region info may not have a + // cancel. This may instead happen in another adjacent task. + if (CancelRegion == OMPD_taskgroup || OMPRegionInfo->hasCancel()) { llvm::Value *Args[] = { emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc), CGF.Builder.getInt32(getCancellationKind(CancelRegion))}; Modified: vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp Sat Feb 25 14:40:42 2017 (r314260) @@ -286,12 +286,12 @@ static void DefineFastIntType(unsigned T /// Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with /// the specified properties. -static const char *getLockFreeValue(unsigned TypeWidth, unsigned InlineWidth) { +static const char *getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign, + unsigned InlineWidth) { // Fully-aligned, power-of-2 sizes no larger than the inline // width will be inlined as lock-free operations. - // Note: we do not need to check alignment since _Atomic(T) is always - // appropriately-aligned in clang. - if ((TypeWidth & (TypeWidth - 1)) == 0 && TypeWidth <= InlineWidth) + if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 && + TypeWidth <= InlineWidth) return "2"; // "always lock free" // We cannot be certain what operations the lib calls might be // able to implement as lock-free on future processors. @@ -881,6 +881,7 @@ static void InitializePredefinedMacros(c #define DEFINE_LOCK_FREE_MACRO(TYPE, Type) \ Builder.defineMacro("__GCC_ATOMIC_" #TYPE "_LOCK_FREE", \ getLockFreeValue(TI.get##Type##Width(), \ + TI.get##Type##Align(), \ InlineWidthBits)); DEFINE_LOCK_FREE_MACRO(BOOL, Bool); DEFINE_LOCK_FREE_MACRO(CHAR, Char); @@ -893,6 +894,7 @@ static void InitializePredefinedMacros(c DEFINE_LOCK_FREE_MACRO(LLONG, LongLong); Builder.defineMacro("__GCC_ATOMIC_POINTER_LOCK_FREE", getLockFreeValue(TI.getPointerWidth(0), + TI.getPointerAlign(0), InlineWidthBits)); #undef DEFINE_LOCK_FREE_MACRO } Modified: vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp ============================================================================== --- vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp Sat Feb 25 14:40:42 2017 (r314260) @@ -179,7 +179,8 @@ void WalkAST::VisitCXXMemberCallExpr(Cal } // Get the callee. - const CXXMethodDecl *MD = dyn_cast(CE->getDirectCallee()); + const CXXMethodDecl *MD = + dyn_cast_or_null(CE->getDirectCallee()); if (MD && MD->isVirtual() && !callIsNonVirtual && !MD->hasAttr() && !MD->getParent()->hasAttr()) ReportVirtualCall(CE, MD->isPure()); Modified: vendor/clang/dist/test/Analysis/virtualcall.cpp ============================================================================== --- vendor/clang/dist/test/Analysis/virtualcall.cpp Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/test/Analysis/virtualcall.cpp Sat Feb 25 14:40:42 2017 (r314260) @@ -115,12 +115,23 @@ public: int foo() override; }; +// Regression test: don't crash when there's no direct callee. +class F { +public: + F() { + void (F::* ptr)() = &F::foo; + (this->*ptr)(); + } + void foo(); +}; + int main() { A *a; B *b; C *c; D *d; E *e; + F *f; } #include "virtualcall.h" Modified: vendor/clang/dist/test/OpenMP/cancellation_point_codegen.cpp ============================================================================== --- vendor/clang/dist/test/OpenMP/cancellation_point_codegen.cpp Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/test/OpenMP/cancellation_point_codegen.cpp Sat Feb 25 14:40:42 2017 (r314260) @@ -78,6 +78,12 @@ for (int i = 0; i < argc; ++i) { } // CHECK: call i8* @__kmpc_omp_task_alloc( // CHECK: call i32 @__kmpc_omp_task( +#pragma omp task +{ +#pragma omp cancellation point taskgroup +} +// CHECK: call i8* @__kmpc_omp_task_alloc( +// CHECK: call i32 @__kmpc_omp_task( #pragma omp parallel sections { { @@ -125,6 +131,15 @@ for (int i = 0; i < argc; ++i) { // CHECK: [[RETURN]] // CHECK: ret i32 0 +// CHECK: define internal i32 @{{[^(]+}}(i32 +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 4) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]], +// CHECK: [[EXIT]] +// CHECK: br label %[[RETURN:.+]] +// CHECK: [[RETURN]] +// CHECK: ret i32 0 + // CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}}) // CHECK: call void @__kmpc_for_static_init_4( // CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 3) Modified: vendor/clang/dist/test/Sema/atomic-ops.c ============================================================================== --- vendor/clang/dist/test/Sema/atomic-ops.c Sat Feb 25 14:40:37 2017 (r314259) +++ vendor/clang/dist/test/Sema/atomic-ops.c Sat Feb 25 14:40:42 2017 (r314260) @@ -14,7 +14,11 @@ _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK _Static_assert(__GCC_ATOMIC_SHORT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_INT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_LONG_LOCK_FREE == 2, ""); +#ifdef __i386__ +_Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 1, ""); +#else _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 2, ""); +#endif _Static_assert(__GCC_ATOMIC_POINTER_LOCK_FREE == 2, ""); _Static_assert(__c11_atomic_is_lock_free(1), "");