Skip to content

Commit cb28f0f

Browse files
committed
Merge remote-tracking branch 'upstream/release/12.x' into rustc/12.0-2021-02-03
2 parents efa7d85 + 76d5d54 commit cb28f0f

File tree

289 files changed

+8524
-7705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+8524
-7705
lines changed

.github/workflows/clang-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: llvm/actions/install-ninja@main
3636
- uses: actions/checkout@v1
3737
with:
38-
fetch-depth: 1
38+
fetch-depth: 250
3939
- name: Test clang
4040
uses: llvm/actions/build-test-llvm-project@main
4141
with:

.github/workflows/libclang-abi-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Checkout source
2929
uses: actions/checkout@v1
3030
with:
31-
fetch-depth: 1
31+
fetch-depth: 250
3232

3333
- name: Get LLVM version
3434
id: version

.github/workflows/libclc-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: llvm/actions/install-ninja@main
3939
- uses: actions/checkout@v1
4040
with:
41-
fetch-depth: 1
41+
fetch-depth: 250
4242
- name: Build clang
4343
uses: llvm/actions/build-test-llvm-project@main
4444
with:

.github/workflows/lld-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: llvm/actions/install-ninja@main
3636
- uses: actions/checkout@v1
3737
with:
38-
fetch-depth: 1
38+
fetch-depth: 250
3939
- name: Test lld
4040
uses: llvm/actions/build-test-llvm-project@main
4141
with:

.github/workflows/lldb-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: llvm/actions/install-ninja@main
4141
- uses: actions/checkout@v1
4242
with:
43-
fetch-depth: 1
43+
fetch-depth: 250
4444
- name: Build lldb
4545
uses: llvm/actions/build-test-llvm-project@main
4646
with:

.github/workflows/llvm-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: llvm/actions/install-ninja@main
3434
- uses: actions/checkout@v1
3535
with:
36-
fetch-depth: 1
36+
fetch-depth: 250
3737
- name: Test llvm
3838
uses: llvm/actions/build-test-llvm-project@main
3939
with:
@@ -52,7 +52,7 @@ jobs:
5252
- name: Checkout source
5353
uses: actions/checkout@v1
5454
with:
55-
fetch-depth: 1
55+
fetch-depth: 250
5656

5757
- name: Get LLVM version
5858
id: version

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ static bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl,
352352
return false;
353353
if (FDecl->getAccess() != AS_public && FDecl->getAccess() != AS_none)
354354
return false;
355+
// If the function doesn't have a name thats an identifier, can occur of the
356+
// function is an operator overload, bail out early.
357+
if (!FDecl->getDeclName().isIdentifier())
358+
return false;
355359
enum MainType { None, Main, WMain };
356360
auto IsCharPtrPtr = [](QualType QType) -> MainType {
357361
if (QType.isNull())

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <atomic>
3535
#include <chrono>
3636
#include <condition_variable>
37+
#include <mutex>
3738
#include <string>
3839
#include <tuple>
3940
#include <vector>
@@ -567,7 +568,10 @@ class DirectoryBasedGlobalCompilationDatabase::BroadcastThread {
567568
}
568569

569570
~BroadcastThread() {
570-
ShouldStop.store(true, std::memory_order_release);
571+
{
572+
std::lock_guard<std::mutex> Lock(Mu);
573+
ShouldStop.store(true, std::memory_order_release);
574+
}
571575
CV.notify_all();
572576
Thread.join();
573577
}

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@
2727

2828
namespace clang {
2929
namespace clangd {
30+
namespace {
31+
32+
// Helper that doesn't treat `null` and absent fields as failures.
33+
template <typename T>
34+
bool mapOptOrNull(const llvm::json::Value &Params, llvm::StringLiteral Prop,
35+
T &Out, llvm::json::Path P) {
36+
auto *O = Params.getAsObject();
37+
assert(O);
38+
auto *V = O->get(Prop);
39+
// Field is missing or null.
40+
if (!V || V->getAsNull().hasValue())
41+
return true;
42+
return fromJSON(*V, Out, P.field(Prop));
43+
}
44+
} // namespace
3045

3146
char LSPError::ID;
3247

@@ -490,7 +505,7 @@ bool fromJSON(const llvm::json::Value &Params, DidChangeTextDocumentParams &R,
490505
return O && O.map("textDocument", R.textDocument) &&
491506
O.map("contentChanges", R.contentChanges) &&
492507
O.map("wantDiagnostics", R.wantDiagnostics) &&
493-
O.mapOptional("forceRebuild", R.forceRebuild);
508+
mapOptOrNull(Params, "forceRebuild", R.forceRebuild, P);
494509
}
495510

496511
bool fromJSON(const llvm::json::Value &E, FileChangeType &Out,
@@ -580,10 +595,10 @@ bool fromJSON(const llvm::json::Value &Params, Diagnostic &R,
580595
llvm::json::Path P) {
581596
llvm::json::ObjectMapper O(Params, P);
582597
return O && O.map("range", R.range) && O.map("message", R.message) &&
583-
O.mapOptional("severity", R.severity) &&
584-
O.mapOptional("category", R.category) &&
585-
O.mapOptional("code", R.code) && O.mapOptional("source", R.source);
586-
return true;
598+
mapOptOrNull(Params, "severity", R.severity, P) &&
599+
mapOptOrNull(Params, "category", R.category, P) &&
600+
mapOptOrNull(Params, "code", R.code, P) &&
601+
mapOptOrNull(Params, "source", R.source, P);
587602
}
588603

589604
llvm::json::Value toJSON(const PublishDiagnosticsParams &PDP) {
@@ -818,7 +833,7 @@ bool fromJSON(const llvm::json::Value &Params, CompletionContext &R,
818833
llvm::json::ObjectMapper O(Params, P);
819834
int TriggerKind;
820835
if (!O || !O.map("triggerKind", TriggerKind) ||
821-
!O.mapOptional("triggerCharacter", R.triggerCharacter))
836+
!mapOptOrNull(Params, "triggerCharacter", R.triggerCharacter, P))
822837
return false;
823838
R.triggerKind = static_cast<CompletionTriggerKind>(TriggerKind);
824839
return true;
@@ -1121,8 +1136,8 @@ bool fromJSON(const llvm::json::Value &Params, ConfigurationSettings &S,
11211136
llvm::json::ObjectMapper O(Params, P);
11221137
if (!O)
11231138
return true; // 'any' type in LSP.
1124-
return O.mapOptional("compilationDatabaseChanges",
1125-
S.compilationDatabaseChanges);
1139+
return mapOptOrNull(Params, "compilationDatabaseChanges",
1140+
S.compilationDatabaseChanges, P);
11261141
}
11271142

11281143
bool fromJSON(const llvm::json::Value &Params, InitializationOptions &Opts,
@@ -1133,8 +1148,8 @@ bool fromJSON(const llvm::json::Value &Params, InitializationOptions &Opts,
11331148

11341149
return fromJSON(Params, Opts.ConfigSettings, P) &&
11351150
O.map("compilationDatabasePath", Opts.compilationDatabasePath) &&
1136-
O.mapOptional("fallbackFlags", Opts.fallbackFlags) &&
1137-
O.mapOptional("clangdFileStatus", Opts.FileStatus);
1151+
mapOptOrNull(Params, "fallbackFlags", Opts.fallbackFlags, P) &&
1152+
mapOptOrNull(Params, "clangdFileStatus", Opts.FileStatus, P);
11381153
}
11391154

11401155
bool fromJSON(const llvm::json::Value &E, TypeHierarchyDirection &Out,
@@ -1190,10 +1205,11 @@ bool fromJSON(const llvm::json::Value &Params, TypeHierarchyItem &I,
11901205
return O && O.map("name", I.name) && O.map("kind", I.kind) &&
11911206
O.map("uri", I.uri) && O.map("range", I.range) &&
11921207
O.map("selectionRange", I.selectionRange) &&
1193-
O.mapOptional("detail", I.detail) &&
1194-
O.mapOptional("deprecated", I.deprecated) &&
1195-
O.mapOptional("parents", I.parents) &&
1196-
O.mapOptional("children", I.children) && O.mapOptional("data", I.data);
1208+
mapOptOrNull(Params, "detail", I.detail, P) &&
1209+
mapOptOrNull(Params, "deprecated", I.deprecated, P) &&
1210+
mapOptOrNull(Params, "parents", I.parents, P) &&
1211+
mapOptOrNull(Params, "children", I.children, P) &&
1212+
mapOptOrNull(Params, "data", I.data, P);
11971213
}
11981214

11991215
bool fromJSON(const llvm::json::Value &Params,
@@ -1238,7 +1254,7 @@ bool fromJSON(const llvm::json::Value &Params, CallHierarchyItem &I,
12381254
return O && O.map("name", I.name) && O.map("kind", I.kind) &&
12391255
O.map("uri", I.uri) && O.map("range", I.range) &&
12401256
O.map("selectionRange", I.selectionRange) &&
1241-
O.mapOptional("data", I.data);
1257+
mapOptOrNull(Params, "data", I.data, P);
12421258
}
12431259

12441260
bool fromJSON(const llvm::json::Value &Params,

clang-tools-extra/clangd/TidyProvider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class DotClangTidyTree {
106106
llvm::SmallVector<DotClangTidyCache *> Caches;
107107
{
108108
std::lock_guard<std::mutex> Lock(Mu);
109-
for (auto I = path::begin(Parent), E = path::end(Parent); I != E; ++I) {
109+
for (auto I = path::rbegin(Parent), E = path::rend(Parent); I != E; ++I) {
110110
assert(I->end() >= Parent.begin() && I->end() <= Parent.end() &&
111111
"Canonical path components should be substrings");
112112
llvm::StringRef Ancestor(Parent.begin(), I->end() - Parent.begin());

0 commit comments

Comments
 (0)