Vendor import of clang release_40 branch r295910:

https://llvm.org/svn/llvm-project/cfe/branches/release_40@295910
This commit is contained in:
Dimitry Andric 2017-02-23 19:02:12 +00:00
parent eb2854521a
commit 1b6fff624e
4 changed files with 49 additions and 8 deletions

View File

@ -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)

View File

@ -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
----------------------

View File

@ -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")));

View File

@ -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"