aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-02-23 19:02:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-02-23 19:02:12 +0000
commit1b6fff624e24727940c1fe59431e74ef11eda230 (patch)
treef2276a59448bc627bc84546660602d31cfa0793e
parenteb2854521a26d3f186018f1b119761ca7bb90dc2 (diff)
downloadsrc-1b6fff624e24727940c1fe59431e74ef11eda230.tar.gz
src-1b6fff624e24727940c1fe59431e74ef11eda230.zip
Vendor import of clang release_40 branch r295910:vendor/clang/clang-release_40-r295910
Notes
Notes: svn path=/vendor/clang/dist/; revision=314161 svn path=/vendor/clang/clang-release_40-r295910/; revision=314162; tag=vendor/clang/clang-release_40-r295910
-rw-r--r--CMakeLists.txt6
-rw-r--r--docs/ReleaseNotes.rst24
-rw-r--r--lib/Driver/Tools.cpp4
-rw-r--r--test/Driver/openbsd.c23
4 files changed, 49 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c56707e7fb57..ff1ff210b56d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
- list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
+ list(GET CONFIG_OUTPUT 6 LLVM_CONFIG_CMAKE_PATH)
if(NOT MSVC_IDE)
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
@@ -57,6 +57,10 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
+ # Normalize LLVM_CMAKE_PATH. --cmakedir might contain backslashes.
+ # CMake assumes slashes as PATH.
+ file(TO_CMAKE_PATH ${LLVM_CONFIG_CMAKE_PATH} LLVM_CMAKE_PATH)
+
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 08d7a7583f5b..8363ae457dad 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -241,17 +241,27 @@ show the description of the defects.
Static Analyzer
---------------
-...
+With the option --show-description, scan-build's list of defects will also
+show the description of the defects.
-Core Analysis Improvements
-==========================
+The analyzer now provides better support of code that uses gtest.
-- ...
+Several new checks were added:
-New Issues Found
-================
+- 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.
+- The analyzer checks for synthesized copy properties of mutable types in
+ 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
+ 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
+ other Cocoa number objects to scalar values.
-- ...
Python Binding Changes
----------------------
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index b4a83347defa..3c3d453ff7d1 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -8937,6 +8937,10 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+ else if (Args.hasArg(options::OPT_static) &&
+ !Args.hasArg(options::OPT_nopie))
+ CmdArgs.push_back(
+ Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
else
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index 95b9e6ad4f36..587c31ded0a7 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -67,3 +67,26 @@
// CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
// CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
// CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie -static -nopie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
+// CHECK-PIE: "{{.*}}crt0.o"
+// CHECK-PIE-NOT: "-nopie"
+// CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
+// CHECK-STATIC-PIE-NOT: "-nopie"
+// CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"