Skip to content

Commit

Permalink
Merged master:952ddc9866dc into amd-gfx:24e58ba22db5
Browse files Browse the repository at this point in the history
Local branch amd-gfx 24e58ba Merged master:f847094c2468 into amd-gfx:9005424148df
Remote branch master 952ddc9 [lldb] [Plugins/FreeBSDRemote] Disable GetMemoryRegionInfo()
  • Loading branch information
Sw authored and Sw committed Nov 3, 2020
2 parents 24e58ba + 952ddc9 commit 0c4f040
Show file tree
Hide file tree
Showing 48 changed files with 543 additions and 180 deletions.
1 change: 1 addition & 0 deletions clang/lib/Driver/ToolChains/MinGW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ SanitizerMask toolchains::MinGW::getSupportedSanitizers() const {
Res |= SanitizerKind::Address;
Res |= SanitizerKind::PointerCompare;
Res |= SanitizerKind::PointerSubtract;
Res |= SanitizerKind::Vptr;
return Res;
}

Expand Down
9 changes: 9 additions & 0 deletions clang/test/Analysis/scan-build/cxx-name.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REQUIRES: shell

RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s

Check that scan-build sets the CLANG_CXX environment variable (meant to be
consumed by ccc-analyzer) to an appropriate pathname for the clang++ executable,
derived from the pathname of the clang executable:

CHECK: CLANG_CXX=/clang++{{(\.exe)?}}/
2 changes: 1 addition & 1 deletion clang/test/Analysis/scan-build/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ config.substitutions.append(('%scan-build',
'tools',
'scan-build',
'bin')),
config.clang)))
os.path.realpath(config.clang))))
11 changes: 6 additions & 5 deletions clang/test/Driver/fsanitize.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN
// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}

// RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32
// RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX
// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64
// RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-MSVC
// RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX --check-prefix=CHECK-UNDEFINED-MSVC
// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-MSVC
// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64-MINGW
// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX
// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX --check-prefix=CHECK-UNDEFINED-MSVC
// CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
// CHECK-UNDEFINED-WIN64: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib"
// CHECK-UNDEFINED-WIN64-MINGW: "--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a"
// CHECK-UNDEFINED-WIN-CXX: "--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib"
// CHECK-UNDEFINED-WIN-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){17}"}}
// CHECK-UNDEFINED-MSVC-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){17}"}}
// CHECK-UNDEFINED-WIN64-MINGW-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute|vptr),?){18}"}}

// RUN: %clang -target i386-pc-win32 -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-COVERAGE-WIN32
// CHECK-COVERAGE-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/mingw-sanitizers.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a"
// ASAN-X86_64: "--require-defined" "__asan_seh_interceptor"
// ASAN-X86_64: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" "--no-whole-archive"

// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=vptr
2 changes: 1 addition & 1 deletion clang/tools/scan-build/bin/scan-build
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ if ($Clang !~ /\+\+(\.exe)?$/) {
$ClangCXX =~ s/.exe$/++.exe/;
}
else {
$ClangCXX =~ s/\-\d+\.\d+$//;
$ClangCXX =~ s/\-\d+(\.\d+)?$//;
$ClangCXX .= "++";
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "sanitizer_common/sanitizer_platform.h"
#include "ubsan_platform.h"
#if CAN_SANITIZE_UB && !SANITIZER_WINDOWS
#if CAN_SANITIZE_UB && !defined(_MSC_VER)
#include "ubsan_type_hash.h"

#include "sanitizer_common/sanitizer_common.h"
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/ubsan/ubsan_type_hash_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "sanitizer_common/sanitizer_platform.h"
#include "ubsan_platform.h"
#if CAN_SANITIZE_UB && SANITIZER_WINDOWS
#if CAN_SANITIZE_UB && defined(_MSC_VER)
#include "ubsan_type_hash.h"

#include "sanitizer_common/sanitizer_common.h"
Expand Down
2 changes: 2 additions & 0 deletions libcxx/src/filesystem/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,14 @@ namespace {
ec = capture_errno();
return false;
}
read_fd.fd = -1;
ofstream out;
out.__open(write_fd.fd, ios::binary);
if (!out.is_open()) {
ec = capture_errno();
return false;
}
write_fd.fd = -1;

if (in.good() && out.good()) {
using InIt = istreambuf_iterator<char>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ int main(int, char**)
doAppendSourceTest<char32_t>(TC);
}
for (auto const & TC : LongLHSCases) {
(void)TC;
LIBCPP_ONLY(doAppendSourceAllocTest<char>(TC));
LIBCPP_ONLY(doAppendSourceAllocTest<wchar_t>(TC));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ TEST_CASE(test_PR35078)
perms::group_exec|perms::owner_exec|perms::others_exec,
perm_options::remove);

const std::error_code eacess_ec =
std::make_error_code(std::errc::permission_denied);
const std::errc eacess = std::errc::permission_denied;
std::error_code ec = GetTestEC();

const recursive_directory_iterator endIt;
Expand All @@ -287,7 +286,7 @@ TEST_CASE(test_PR35078)
ec = GetTestEC();
it.increment(ec);
TEST_CHECK(ec);
TEST_CHECK(ec == eacess_ec);
TEST_CHECK(ErrorIs(ec, eacess));
TEST_CHECK(it == endIt);
}
{
Expand Down Expand Up @@ -346,8 +345,7 @@ TEST_CASE(test_PR35078_with_symlink)
perms::group_exec|perms::owner_exec|perms::others_exec,
perm_options::remove);

const std::error_code eacess_ec =
std::make_error_code(std::errc::permission_denied);
const std::errc eacess = std::errc::permission_denied;
std::error_code ec = GetTestEC();

const recursive_directory_iterator endIt;
Expand Down Expand Up @@ -397,7 +395,7 @@ TEST_CASE(test_PR35078_with_symlink)
}
} else {
TEST_CHECK(ec);
TEST_CHECK(ec == eacess_ec);
TEST_CHECK(ErrorIs(ec, eacess));
TEST_CHECK(it == endIt);
}
}
Expand Down Expand Up @@ -430,8 +428,7 @@ TEST_CASE(test_PR35078_with_symlink_file)
perms::group_exec|perms::owner_exec|perms::others_exec,
perm_options::remove);

const std::error_code eacess_ec =
std::make_error_code(std::errc::permission_denied);
const std::errc eacess = std::errc::permission_denied;
std::error_code ec = GetTestEC();

const recursive_directory_iterator EndIt;
Expand Down Expand Up @@ -488,7 +485,7 @@ TEST_CASE(test_PR35078_with_symlink_file)
TEST_CHECK(it == EndIt);
} else {
TEST_CHECK(ec);
TEST_CHECK(ec == eacess_ec);
TEST_CHECK(ErrorIs(ec, eacess));
TEST_CHECK(it == EndIt);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ TEST_CASE(basic_test)
} TestCases [] = {
{"", cwd / ""},
{"foo", cwd / "foo"},
{"foo/", cwd / "foo/"},
{"/already_absolute", "/already_absolute"}
{"foo/", cwd / "foo" / ""},
{"/already_absolute", cwd.root_path() / "already_absolute"}
};
for (auto& TC : TestCases) {
std::error_code ec = GetTestEC();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,14 @@ TEST_CASE(test_dir_create_symlink)
{
std::error_code ec = GetTestEC();
fs::copy(dir, dest, copy_options::create_symlinks, ec);
TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
TEST_CHECK(ErrorIs(ec, std::errc::is_a_directory));
TEST_CHECK(!exists(dest));
TEST_CHECK(!is_symlink(dest));
}
{
std::error_code ec = GetTestEC();
fs::copy(dir, dest, copy_options::create_symlinks|copy_options::recursive, ec);
TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
TEST_CHECK(ErrorIs(ec, std::errc::is_a_directory));
TEST_CHECK(!exists(dest));
TEST_CHECK(!is_symlink(dest));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ TEST_CASE(test_no_resolve_symlink_on_symlink)
#endif
std::error_code ec = GetTestEC();
permissions(sym, TC.set_perms, TC.opts | perm_options::nofollow, ec);
TEST_CHECK(ec == expected_ec);
if (expected_ec)
TEST_CHECK(ErrorIs(ec, static_cast<std::errc>(expected_ec.value())));
else
TEST_CHECK(!ec);
TEST_CHECK(status(file).permissions() == file_perms);
TEST_CHECK(symlink_status(sym).permissions() == expected_link_perms);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ TEST_CASE(signature_test)
TEST_CASE(test_status_not_found)
{
static_test_env static_env;
const std::error_code expect_ec =
std::make_error_code(std::errc::no_such_file_or_directory);
const std::errc expect_errc = std::errc::no_such_file_or_directory;
const path cases[] {
static_env.DNE,
static_env.BadSymlink
Expand All @@ -44,7 +43,7 @@ TEST_CASE(test_status_not_found)
std::error_code ec = std::make_error_code(std::errc::address_in_use);
// test non-throwing overload.
file_status st = status(p, ec);
TEST_CHECK(ec == expect_ec);
TEST_CHECK(ErrorIs(ec, expect_errc));
TEST_CHECK(st.type() == file_type::not_found);
TEST_CHECK(st.permissions() == perms::unknown);
// test throwing overload. It should not throw even though it reports
Expand All @@ -63,27 +62,24 @@ TEST_CASE(test_status_cannot_resolve)
const path sym = env.create_symlink("dir/file", "sym");
permissions(dir, perms::none);

const std::error_code set_ec =
std::make_error_code(std::errc::address_in_use);
const std::error_code perm_ec =
std::make_error_code(std::errc::permission_denied);
const std::error_code name_too_long_ec =
std::make_error_code(std::errc::filename_too_long);
const std::errc set_errc = std::errc::address_in_use;
const std::errc perm_errc = std::errc::permission_denied;
const std::errc name_too_long_errc = std::errc::filename_too_long;

struct TestCase {
path p;
std::error_code expect_ec;
std::errc expect_errc;
} const TestCases[] = {
{file, perm_ec},
{sym, perm_ec},
{path(std::string(2500, 'a')), name_too_long_ec}
{file, perm_errc},
{sym, perm_errc},
{path(std::string(2500, 'a')), name_too_long_errc}
};
for (auto& TC : TestCases)
{
{ // test non-throwing case
std::error_code ec = set_ec;
std::error_code ec = std::make_error_code(set_errc);
file_status st = status(TC.p, ec);
TEST_CHECK(ec == TC.expect_ec);
TEST_CHECK(ErrorIs(ec, TC.expect_errc));
TEST_CHECK(st.type() == file_type::none);
TEST_CHECK(st.permissions() == perms::unknown);
}
Expand All @@ -94,7 +90,7 @@ TEST_CASE(test_status_cannot_resolve)
} catch (filesystem_error const& err) {
TEST_CHECK(err.path1() == TC.p);
TEST_CHECK(err.path2() == "");
TEST_CHECK(err.code() == TC.expect_ec);
TEST_CHECK(ErrorIs(err.code(), TC.expect_errc));
}
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ TEST_CASE(signature_test)
TEST_CASE(test_symlink_status_not_found)
{
static_test_env static_env;
const std::error_code expect_ec =
std::make_error_code(std::errc::no_such_file_or_directory);
const std::errc expect_errc = std::errc::no_such_file_or_directory;
const path cases[] {
static_env.DNE
};
for (auto& p : cases) {
std::error_code ec = std::make_error_code(std::errc::address_in_use);
// test non-throwing overload.
file_status st = symlink_status(p, ec);
TEST_CHECK(ec == expect_ec);
TEST_CHECK(ErrorIs(ec, expect_errc));
TEST_CHECK(st.type() == file_type::not_found);
TEST_CHECK(st.permissions() == perms::unknown);
// test throwing overload. It should not throw even though it reports
Expand All @@ -63,20 +62,18 @@ TEST_CASE(test_symlink_status_cannot_resolve)
const path sym_points_in_dir = env.create_symlink("dir/file", "sym");
permissions(dir, perms::none);

const std::error_code set_ec =
std::make_error_code(std::errc::address_in_use);
const std::error_code expect_ec =
std::make_error_code(std::errc::permission_denied);
const std::errc set_errc = std::errc::address_in_use;
const std::errc expect_errc = std::errc::permission_denied;

const path fail_cases[] = {
file_in_dir, sym_in_dir
};
for (auto& p : fail_cases)
{
{ // test non-throwing case
std::error_code ec = set_ec;
std::error_code ec = std::make_error_code(set_errc);
file_status st = symlink_status(p, ec);
TEST_CHECK(ec == expect_ec);
TEST_CHECK(ErrorIs(ec, expect_errc));
TEST_CHECK(st.type() == file_type::none);
TEST_CHECK(st.permissions() == perms::unknown);
}
Expand All @@ -87,15 +84,15 @@ TEST_CASE(test_symlink_status_cannot_resolve)
} catch (filesystem_error const& err) {
TEST_CHECK(err.path1() == p);
TEST_CHECK(err.path2() == "");
TEST_CHECK(err.code() == expect_ec);
TEST_CHECK(ErrorIs(err.code(), expect_errc));
}
}
#endif
}
// Test that a symlink that points into a directory without read perms
// can be stat-ed using symlink_status
{
std::error_code ec = set_ec;
std::error_code ec = std::make_error_code(set_errc);
file_status st = symlink_status(sym_points_in_dir, ec);
TEST_CHECK(!ec);
TEST_CHECK(st.type() == file_type::symlink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST_CASE(basic_tests)
const path dir_perms = env.create_dir("bad_perms_dir");
const path nested_dir = env.create_dir("bad_perms_dir/nested");
permissions(dir_perms, perms::none);
const std::error_code expect_ec = std::make_error_code(std::errc::not_a_directory);
LIBCPP_ONLY(const std::errc expect_errc = std::errc::not_a_directory);
struct TestCase {
std::string name;
path p;
Expand All @@ -75,7 +75,7 @@ TEST_CASE(basic_tests)
PutEnv(TC.name, dne);
ec = GetTestEC();
ret = temp_directory_path(ec);
LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
LIBCPP_ONLY(TEST_CHECK(ErrorIs(ec, expect_errc)));
TEST_CHECK(ec != GetTestEC());
TEST_CHECK(ec);
TEST_CHECK(ret == "");
Expand All @@ -84,7 +84,7 @@ TEST_CASE(basic_tests)
PutEnv(TC.name, file);
ec = GetTestEC();
ret = temp_directory_path(ec);
LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
LIBCPP_ONLY(TEST_CHECK(ErrorIs(ec, expect_errc)));
TEST_CHECK(ec != GetTestEC());
TEST_CHECK(ec);
TEST_CHECK(ret == "");
Expand All @@ -93,7 +93,7 @@ TEST_CASE(basic_tests)
PutEnv(TC.name, nested_dir);
ec = GetTestEC();
ret = temp_directory_path(ec);
TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied));
TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
TEST_CHECK(ret == "");

// Set the env variable to point to a non-existent dir
Expand Down
5 changes: 3 additions & 2 deletions libcxx/test/support/filesystem_test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class static_test_env {
env_.create_file("dir1/file2", 42);
env_.create_file("empty_file");
env_.create_file("non_empty_file", 42);
env_.create_symlink("dir1", "symlink_to_dir", false);
env_.create_symlink("dir1", "symlink_to_dir", false, true);
env_.create_symlink("empty_file", "symlink_to_empty_file", false);
}

Expand Down Expand Up @@ -560,8 +560,9 @@ inline std::error_code GetTestEC(unsigned Idx = 0) {

inline bool ErrorIsImp(const std::error_code& ec,
std::vector<std::errc> const& errors) {
std::error_condition cond = ec.default_error_condition();
for (auto errc : errors) {
if (ec == std::make_error_code(errc))
if (cond.value() == static_cast<int>(errc))
return true;
}
return false;
Expand Down
4 changes: 4 additions & 0 deletions libcxxabi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ endif()
# library.
add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)

# libcxxabi needs to, for various reasons, include the libcpp headers as if
# it is being built as part of libcxx.
add_definitions(-D_LIBCPP_BUILDING_LIBRARY)

# Disable DLL annotations on Windows for static builds.
if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
Expand Down
Loading

0 comments on commit 0c4f040

Please sign in to comment.