summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-02-25 14:40:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-02-25 14:40:42 +0000
commit2344cbce571b60627653ec3015125737e5f8c68d (patch)
tree978eae48e869bcf6e7f04f92efa77d9a1fd4a7b8
parent47c4f8f1661f7cab0cf1ade9824cf0f5f1762403 (diff)
downloadsrc-test2-2344cbce571b60627653ec3015125737e5f8c68d.tar.gz
src-test2-2344cbce571b60627653ec3015125737e5f8c68d.zip
Notes
-rw-r--r--docs/ReleaseNotes.rst129
-rw-r--r--lib/CodeGen/CGOpenMPRuntime.cpp4
-rw-r--r--lib/Frontend/InitPreprocessor.cpp10
-rw-r--r--lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp3
-rw-r--r--test/Analysis/virtualcall.cpp11
-rw-r--r--test/OpenMP/cancellation_point_codegen.cpp15
-rw-r--r--test/Sema/atomic-ops.c4
7 files changed, 58 insertions, 118 deletions
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 8363ae457dad..3278bcc03381 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -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 <http://llvm.org/>`_
-.. warning::
-
- These are in-progress notes for the upcoming Clang 4.0.0 release. You may
- prefer the `Clang 3.9 Release Notes
- <http://llvm.org/releases/3.9.0/tools/clang/docs/ReleaseNotes.html>`_.
-
Introduction
============
@@ -42,7 +36,8 @@ sections with improvements to Clang's support for those languages.
Major New Features
------------------
-- The ``diagnose_if`` attribute has been added to clang. This attribute allows
+- The `diagnose_if <AttributeReference.html#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
- <https://clang.llvm.org/docs/UsersManual.html#opencl-features>`_ to Clang
+* Added `the OpenCL manual <UsersManual.html#opencl-features>`_ 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
======================
diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
index df3f38c6ee9e..40252171368b 100644
--- a/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4697,7 +4697,9 @@ void CGOpenMPRuntime::emitCancellationPointCall(
// global_tid, kmp_int32 cncl_kind);
if (auto *OMPRegionInfo =
dyn_cast_or_null<CGOpenMPRegionInfo>(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))};
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 4502c92499a7..17603ada11d1 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -286,12 +286,12 @@ static void DefineFastIntType(unsigned TypeWidth, bool IsSigned,
/// 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(const TargetInfo &TI,
#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(const TargetInfo &TI,
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
}
diff --git a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index 15e8ea31c4c4..b47762b915ce 100644
--- a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -179,7 +179,8 @@ void WalkAST::VisitCXXMemberCallExpr(CallExpr *CE) {
}
// Get the callee.
- const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CE->getDirectCallee());
+ const CXXMethodDecl *MD =
+ dyn_cast_or_null<CXXMethodDecl>(CE->getDirectCallee());
if (MD && MD->isVirtual() && !callIsNonVirtual && !MD->hasAttr<FinalAttr>() &&
!MD->getParent()->hasAttr<FinalAttr>())
ReportVirtualCall(CE, MD->isPure());
diff --git a/test/Analysis/virtualcall.cpp b/test/Analysis/virtualcall.cpp
index e42b898a0738..311f0a137c6f 100644
--- a/test/Analysis/virtualcall.cpp
+++ b/test/Analysis/virtualcall.cpp
@@ -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"
diff --git a/test/OpenMP/cancellation_point_codegen.cpp b/test/OpenMP/cancellation_point_codegen.cpp
index 22969141af54..de65c114027a 100644
--- a/test/OpenMP/cancellation_point_codegen.cpp
+++ b/test/OpenMP/cancellation_point_codegen.cpp
@@ -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)
diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c
index d3ebdf67db0f..8ebf3eaed4af 100644
--- a/test/Sema/atomic-ops.c
+++ b/test/Sema/atomic-ops.c
@@ -14,7 +14,11 @@ _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK_FREE == 2, "");
_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), "");