Skip to content

Commit

Permalink
Merged master:e20a215992d into amd-gfx:791da285c8e
Browse files Browse the repository at this point in the history
Local branch amd-gfx 791da28 Merged master:710fa2c4ee3 into amd-gfx:ca022c58f8c
Remote branch master e20a215 [ELF] Add convenience TableGen classes to enforce two dashes for options not supported by GNU ld
  • Loading branch information
Sw authored and Sw committed May 8, 2020
2 parents 791da28 + e20a215 commit fb0f2ab
Show file tree
Hide file tree
Showing 70 changed files with 2,319 additions and 3,362 deletions.
6 changes: 4 additions & 2 deletions clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ bool AddUsing::prepare(const Selection &Inputs) {
return false;

if (auto *D = Node->ASTNode.get<DeclRefExpr>()) {
QualifierToRemove = D->getQualifierLoc();
Name = D->getDecl()->getName();
if (auto *II = D->getDecl()->getIdentifier()) {
QualifierToRemove = D->getQualifierLoc();
Name = II->getName();
}
} else if (auto *T = Node->ASTNode.get<TypeLoc>()) {
if (auto E = T->getAs<ElaboratedTypeLoc>()) {
if (auto *BaseTypeIdentifier =
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/tool/ClangdMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ int main(int argc, char *argv[]) {
R"(clangd is a language server that provides IDE-like features to editors.
It should be used via an editor plugin rather than invoked directly. For more information, see:
https://clang.llvm.org/extra/clangd/
https://clangd.llvm.org/
https://microsoft.github.io/language-server-protocol/
clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/clangd/unittests/TweakTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,7 @@ class cc {
public:
struct st {};
static void mm() {}
cc operator|(const cc& x) const { return x; }
};
}
})cpp";
Expand All @@ -2463,6 +2464,9 @@ class cc {
// test that we don't crash.
EXPECT_UNAVAILABLE(Header +
"template<typename TT> using foo = one::tt<T^T>;");
// Test that we don't crash or misbehave on unnamed DeclRefExpr.
EXPECT_UNAVAILABLE(Header +
"void fun() { one::two::cc() ^| one::two::cc(); }");

// Check that we do not trigger in header files.
FileName = "test.h";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// explicit codecvt(size_t refs = 0);

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;

struct my_facet : F {
static int count;

explicit my_facet(std::size_t refs = 0) : F(refs) { ++count; }

~my_facet() { --count; }
};

int my_facet::count = 0;

int main(int, char**) {
{
std::locale l(std::locale::classic(), new my_facet);
assert(my_facet::count == 1);
}
assert(my_facet::count == 0);
{
my_facet f(1);
assert(my_facet::count == 1);
{
std::locale l(std::locale::classic(), &f);
assert(my_facet::count == 1);
}
assert(my_facet::count == 1);
}
assert(my_facet::count == 0);

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char32_t, char8_t, mbstate_t>

// explicit codecvt(size_t refs = 0);

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

using F = std::codecvt<char32_t, char8_t, std::mbstate_t>;

struct my_facet : F {
static int count;

explicit my_facet(std::size_t refs = 0) : F(refs) { ++count; }

~my_facet() { --count; }
};

int my_facet::count = 0;

int main(int, char**) {
{
std::locale l(std::locale::classic(), new my_facet);
assert(my_facet::count == 1);
}
assert(my_facet::count == 0);
{
my_facet f(1);
assert(my_facet::count == 1);
{
std::locale l(std::locale::classic(), &f);
assert(my_facet::count == 1);
}
assert(my_facet::count == 1);
}
assert(my_facet::count == 0);

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// bool always_noconv() const noexcept;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
assert(!f.always_noconv());
static_assert(noexcept(f.always_noconv()));
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// int encoding() const noexcept;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
assert(f.encoding() == 0);
static_assert(noexcept(f.encoding()));
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// result in(stateT& state,
// const externT* from, const externT* from_end, const externT*& from_next,
// internT* to, internT* to_end, internT*& to_next) const;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F::extern_type from[] = u8"some text";
F::intern_type to[9];
const F& f = std::use_facet<F>(std::locale::classic());
std::mbstate_t mbs = {};
const F::extern_type* from_next = nullptr;
F::intern_type* to_next = nullptr;
assert(f.in(mbs, from, from + 9, from_next, to, to + 9, to_next) == F::ok);
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
assert(to[i] == from[i]);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
std::mbstate_t mbs = {};
const char8_t from[] = u8"some text";
assert(f.length(mbs, from, from + 10, 0) == 0);
assert(f.length(mbs, from, from + 10, 8) == 8);
assert(f.length(mbs, from, from + 10, 9) == 9);
assert(f.length(mbs, from, from + 10, 10) == 10);
assert(f.length(mbs, from, from + 10, 100) == 10);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// int max_length() const noexcept;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
assert(f.max_length() == 4);
static_assert(noexcept(f.max_length()));
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// result out(stateT& state,
// const internT* from, const internT* from_end, const internT*& from_next,
// externT* to, externT* to_end, externT*& to_next) const;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
F::extern_type to[9] = {0};
std::mbstate_t mbs = {};
const F::intern_type* from_next = nullptr;
F::extern_type* to_next = nullptr;
F::result r = f.out(mbs, from, from + 9, from_next, to, to + 9, to_next);
assert(r == F::ok);
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
assert(to[i] == from[i]);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <locale>

// template <> class codecvt<char16_t, char8_t, mbstate_t>

// result unshift(stateT& state,
// externT* to, externT* to_end, externT*& to_next) const;

// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17

// C++20 codecvt specializations for char8_t are not yet implemented:
// UNSUPPORTED: libc++

#include <cassert>
#include <locale>

int main(int, char**) {
using F = std::codecvt<char16_t, char8_t, std::mbstate_t>;
const F& f = std::use_facet<F>(std::locale::classic());
std::mbstate_t mbs = {};
char8_t to[3];
char8_t* to_next = nullptr;
assert(f.unshift(mbs, to, to + 3, to_next) == F::noconv);
assert(to_next == to);
return 0;
}
Loading

0 comments on commit fb0f2ab

Please sign in to comment.