Skip to content

Commit 87c4d48

Browse files
committed
Merge remote-tracking branch 'upstream/release/15.x' into rustc/15.0-2022-08-09
2 parents e3be3f6 + 11ba13a commit 87c4d48

File tree

240 files changed

+11045
-2498
lines changed

Some content is hidden

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

240 files changed

+11045
-2498
lines changed

.github/workflows/llvm-project-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ jobs:
4646
uses: llvm/actions/setup-windows@main
4747
with:
4848
arch: amd64
49+
# On Windows, starting with win19/20220814.1, cmake choose the 32-bit
50+
# python3.10.6 libraries instead of the 64-bit libraries when building
51+
# lldb. Using this setup-python action to make 3.10 the default
52+
# python fixes this.
53+
- name: Setup Python
54+
uses: actions/setup-python@v4
55+
with:
56+
python-version: '3.10'
4957
- name: Install Ninja
5058
uses: llvm/actions/install-ninja@main
5159
# actions/checkout deletes any existing files in the new git directory,

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Validate Tag
1616
id: validate-tag
1717
run: |
18-
test "${{ github.actor }}" = "tstellar"
18+
test "${{ github.actor }}" = "tstellar" || test "${{ github.actor }}" = "tru"
1919
echo "${{ github.ref_name }}" | grep -e '^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
2020
release_version=`echo "${{ github.ref_name }}" | sed 's/llvmorg-//g'`
2121
echo "::set-output name=release-version::$release_version"

.github/workflows/version-check.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,29 @@
44
import re
55
import sys
66

7+
8+
def get_version_from_tag(tag):
9+
m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)(-rc[0-9]+)?$', tag)
10+
if m:
11+
if m.lastindex == 4:
12+
# We have an rc tag.
13+
return m.group(1,2,3)
14+
# We have a final release tag.
15+
return (m.group(1), m.group(2), int(m.group(3)) + 1)
16+
17+
m = re.match('llvmorg-([0-9]+)-init', tag)
18+
if m:
19+
return (int(m.group(1)) + 1, 0, 0)
20+
21+
raise Exception(f"error: Tag is not valid: {tag}")
22+
23+
724
version = sys.argv[1]
825

926
repo = Repo()
1027

1128
tag = repo.git.describe(tags = True, abbrev=0)
12-
m = re.match('llvmorg-([0-9]+)\.([0-9]+)\.([0-9]+)', tag)
13-
14-
if m:
15-
expected_major = m.group(1)
16-
expected_minor = m.group(2)
17-
expected_patch = int(m.group(3)) + 1
18-
else:
19-
# If the previous tag is llvmorg-X-init, then we should be at version X.0.0.
20-
m = re.match('llvmorg-([0-9]+)-init', tag)
21-
if not m:
22-
print("error: Tag is not valid: ", tag)
23-
sys.exit(1)
24-
expected_major = m.group(1)
25-
expected_minor = 0
26-
expected_patch = 0
27-
28-
expected_version = f"{expected_major}.{expected_minor}.{expected_patch}"
29-
30-
m = re.match("[0-9]+\.[0-9]+\.[0-9]+", version)
31-
if not m:
32-
print("error: Version is not valid: ", version)
33-
sys.exit(1)
29+
expected_version = '.'.join(get_version_from_tag(tag))
3430

3531
if version != expected_version:
3632
print("error: Expected version", expected_version, "but found version", version)

bolt/lib/Core/DebugData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,7 @@ void DwarfLineTable::emit(BinaryContext &BC, MCStreamer &Streamer) {
15931593
// Some versions of GCC output DWARF5 .debug_info, but DWARF4 or lower
15941594
// .debug_line
15951595
if (LineStrSection) {
1596-
LineStr = MCDwarfLineStr(*BC.Ctx);
1596+
LineStr.emplace(*BC.Ctx);
15971597
parseAndPopulateDebugLineStr(*LineStrSection, *LineStr, BC, Streamer);
15981598
}
15991599

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "support/Trace.h"
2727
#include "clang/Tooling/Core/Replacement.h"
2828
#include "llvm/ADT/ArrayRef.h"
29+
#include "llvm/ADT/FunctionExtras.h"
30+
#include "llvm/ADT/None.h"
2931
#include "llvm/ADT/Optional.h"
3032
#include "llvm/ADT/ScopeExit.h"
3133
#include "llvm/ADT/StringRef.h"
@@ -571,8 +573,12 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
571573
{"referencesProvider", true},
572574
{"astProvider", true}, // clangd extension
573575
{"typeHierarchyProvider", true},
574-
{"memoryUsageProvider", true}, // clangd extension
575-
{"compilationDatabase", // clangd extension
576+
// Unfortunately our extension made use of the same capability name as the
577+
// standard. Advertise this capability to tell clients that implement our
578+
// extension we really have support for the standardized one as well.
579+
{"standardTypeHierarchyProvider", true}, // clangd extension
580+
{"memoryUsageProvider", true}, // clangd extension
581+
{"compilationDatabase", // clangd extension
576582
llvm::json::Object{{"automaticReload", true}}},
577583
{"callHierarchyProvider", true},
578584
{"clangdInlayHintsProvider", true},
@@ -1183,18 +1189,94 @@ void ClangdLSPServer::onHover(const TextDocumentPositionParams &Params,
11831189
});
11841190
}
11851191

1186-
void ClangdLSPServer::onTypeHierarchy(
1187-
const TypeHierarchyParams &Params,
1188-
Callback<Optional<TypeHierarchyItem>> Reply) {
1192+
// Our extension has a different representation on the wire than the standard.
1193+
// https://clangd.llvm.org/extensions#type-hierarchy
1194+
llvm::json::Value serializeTHIForExtension(TypeHierarchyItem THI) {
1195+
llvm::json::Object Result{{
1196+
{"name", std::move(THI.name)},
1197+
{"kind", static_cast<int>(THI.kind)},
1198+
{"uri", std::move(THI.uri)},
1199+
{"range", THI.range},
1200+
{"selectionRange", THI.selectionRange},
1201+
{"data", std::move(THI.data)},
1202+
}};
1203+
if (THI.deprecated)
1204+
Result["deprecated"] = THI.deprecated;
1205+
if (THI.detail)
1206+
Result["detail"] = std::move(*THI.detail);
1207+
1208+
if (THI.parents) {
1209+
llvm::json::Array Parents;
1210+
for (auto &Parent : *THI.parents)
1211+
Parents.emplace_back(serializeTHIForExtension(std::move(Parent)));
1212+
Result["parents"] = std::move(Parents);
1213+
}
1214+
1215+
if (THI.children) {
1216+
llvm::json::Array Children;
1217+
for (auto &child : *THI.children)
1218+
Children.emplace_back(serializeTHIForExtension(std::move(child)));
1219+
Result["children"] = std::move(Children);
1220+
}
1221+
return Result;
1222+
}
1223+
1224+
void ClangdLSPServer::onTypeHierarchy(const TypeHierarchyPrepareParams &Params,
1225+
Callback<llvm::json::Value> Reply) {
1226+
auto Serialize =
1227+
[Reply = std::move(Reply)](
1228+
llvm::Expected<std::vector<TypeHierarchyItem>> Resp) mutable {
1229+
if (!Resp) {
1230+
Reply(Resp.takeError());
1231+
return;
1232+
}
1233+
if (Resp->empty()) {
1234+
Reply(nullptr);
1235+
return;
1236+
}
1237+
Reply(serializeTHIForExtension(std::move(Resp->front())));
1238+
};
11891239
Server->typeHierarchy(Params.textDocument.uri.file(), Params.position,
1190-
Params.resolve, Params.direction, std::move(Reply));
1240+
Params.resolve, Params.direction, std::move(Serialize));
11911241
}
11921242

11931243
void ClangdLSPServer::onResolveTypeHierarchy(
11941244
const ResolveTypeHierarchyItemParams &Params,
1195-
Callback<Optional<TypeHierarchyItem>> Reply) {
1245+
Callback<llvm::json::Value> Reply) {
1246+
auto Serialize =
1247+
[Reply = std::move(Reply)](
1248+
llvm::Expected<llvm::Optional<TypeHierarchyItem>> Resp) mutable {
1249+
if (!Resp) {
1250+
Reply(Resp.takeError());
1251+
return;
1252+
}
1253+
if (!*Resp) {
1254+
Reply(std::move(*Resp));
1255+
return;
1256+
}
1257+
Reply(serializeTHIForExtension(std::move(**Resp)));
1258+
};
11961259
Server->resolveTypeHierarchy(Params.item, Params.resolve, Params.direction,
1197-
std::move(Reply));
1260+
std::move(Serialize));
1261+
}
1262+
1263+
void ClangdLSPServer::onPrepareTypeHierarchy(
1264+
const TypeHierarchyPrepareParams &Params,
1265+
Callback<std::vector<TypeHierarchyItem>> Reply) {
1266+
Server->typeHierarchy(Params.textDocument.uri.file(), Params.position,
1267+
Params.resolve, Params.direction, std::move(Reply));
1268+
}
1269+
1270+
void ClangdLSPServer::onSuperTypes(
1271+
const ResolveTypeHierarchyItemParams &Params,
1272+
Callback<llvm::Optional<std::vector<TypeHierarchyItem>>> Reply) {
1273+
Server->superTypes(Params.item, std::move(Reply));
1274+
}
1275+
1276+
void ClangdLSPServer::onSubTypes(
1277+
const ResolveTypeHierarchyItemParams &Params,
1278+
Callback<std::vector<TypeHierarchyItem>> Reply) {
1279+
Server->subTypes(Params.item, std::move(Reply));
11981280
}
11991281

12001282
void ClangdLSPServer::onPrepareCallHierarchy(
@@ -1523,6 +1605,9 @@ void ClangdLSPServer::bindMethods(LSPBinder &Bind,
15231605
Bind.method("textDocument/symbolInfo", this, &ClangdLSPServer::onSymbolInfo);
15241606
Bind.method("textDocument/typeHierarchy", this, &ClangdLSPServer::onTypeHierarchy);
15251607
Bind.method("typeHierarchy/resolve", this, &ClangdLSPServer::onResolveTypeHierarchy);
1608+
Bind.method("textDocument/prepareTypeHierarchy", this, &ClangdLSPServer::onPrepareTypeHierarchy);
1609+
Bind.method("typeHierarchy/supertypes", this, &ClangdLSPServer::onSuperTypes);
1610+
Bind.method("typeHierarchy/subtypes", this, &ClangdLSPServer::onSubTypes);
15261611
Bind.method("textDocument/prepareCallHierarchy", this, &ClangdLSPServer::onPrepareCallHierarchy);
15271612
Bind.method("callHierarchy/incomingCalls", this, &ClangdLSPServer::onCallHierarchyIncomingCalls);
15281613
Bind.method("textDocument/selectionRange", this, &ClangdLSPServer::onSelectionRange);

clang-tools-extra/clangd/ClangdLSPServer.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <chrono>
2424
#include <cstddef>
2525
#include <memory>
26+
#include <vector>
2627

2728
namespace clang {
2829
namespace clangd {
@@ -132,10 +133,16 @@ class ClangdLSPServer : private ClangdServer::Callbacks,
132133
void onRename(const RenameParams &, Callback<WorkspaceEdit>);
133134
void onHover(const TextDocumentPositionParams &,
134135
Callback<llvm::Optional<Hover>>);
135-
void onTypeHierarchy(const TypeHierarchyParams &,
136-
Callback<llvm::Optional<TypeHierarchyItem>>);
136+
void onPrepareTypeHierarchy(const TypeHierarchyPrepareParams &,
137+
Callback<std::vector<TypeHierarchyItem>>);
138+
void onSuperTypes(const ResolveTypeHierarchyItemParams &,
139+
Callback<llvm::Optional<std::vector<TypeHierarchyItem>>>);
140+
void onSubTypes(const ResolveTypeHierarchyItemParams &,
141+
Callback<std::vector<TypeHierarchyItem>>);
142+
void onTypeHierarchy(const TypeHierarchyPrepareParams &,
143+
Callback<llvm::json::Value>);
137144
void onResolveTypeHierarchy(const ResolveTypeHierarchyItemParams &,
138-
Callback<llvm::Optional<TypeHierarchyItem>>);
145+
Callback<llvm::json::Value>);
139146
void onPrepareCallHierarchy(const CallHierarchyPrepareParams &,
140147
Callback<std::vector<CallHierarchyItem>>);
141148
void onCallHierarchyIncomingCalls(

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ void ClangdServer::findHover(PathRef File, Position Pos,
751751

752752
void ClangdServer::typeHierarchy(PathRef File, Position Pos, int Resolve,
753753
TypeHierarchyDirection Direction,
754-
Callback<Optional<TypeHierarchyItem>> CB) {
754+
Callback<std::vector<TypeHierarchyItem>> CB) {
755755
auto Action = [File = File.str(), Pos, Resolve, Direction, CB = std::move(CB),
756756
this](Expected<InputsAndAST> InpAST) mutable {
757757
if (!InpAST)
@@ -763,6 +763,22 @@ void ClangdServer::typeHierarchy(PathRef File, Position Pos, int Resolve,
763763
WorkScheduler->runWithAST("TypeHierarchy", File, std::move(Action));
764764
}
765765

766+
void ClangdServer::superTypes(
767+
const TypeHierarchyItem &Item,
768+
Callback<llvm::Optional<std::vector<TypeHierarchyItem>>> CB) {
769+
WorkScheduler->run("typeHierarchy/superTypes", /*Path=*/"",
770+
[=, CB = std::move(CB)]() mutable {
771+
CB(clangd::superTypes(Item, Index));
772+
});
773+
}
774+
775+
void ClangdServer::subTypes(const TypeHierarchyItem &Item,
776+
Callback<std::vector<TypeHierarchyItem>> CB) {
777+
WorkScheduler->run(
778+
"typeHierarchy/subTypes", /*Path=*/"",
779+
[=, CB = std::move(CB)]() mutable { CB(clangd::subTypes(Item, Index)); });
780+
}
781+
766782
void ClangdServer::resolveTypeHierarchy(
767783
TypeHierarchyItem Item, int Resolve, TypeHierarchyDirection Direction,
768784
Callback<llvm::Optional<TypeHierarchyItem>> CB) {

clang-tools-extra/clangd/ClangdServer.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,13 @@ class ClangdServer {
253253
/// Get information about type hierarchy for a given position.
254254
void typeHierarchy(PathRef File, Position Pos, int Resolve,
255255
TypeHierarchyDirection Direction,
256-
Callback<llvm::Optional<TypeHierarchyItem>> CB);
256+
Callback<std::vector<TypeHierarchyItem>> CB);
257+
/// Get direct parents of a type hierarchy item.
258+
void superTypes(const TypeHierarchyItem &Item,
259+
Callback<llvm::Optional<std::vector<TypeHierarchyItem>>> CB);
260+
/// Get direct children of a type hierarchy item.
261+
void subTypes(const TypeHierarchyItem &Item,
262+
Callback<std::vector<TypeHierarchyItem>> CB);
257263

258264
/// Resolve type hierarchy item in the given direction.
259265
void resolveTypeHierarchy(TypeHierarchyItem Item, int Resolve,

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ void collectDesignators(const InitListExpr *Sem,
141141
Fields.next(); // Always advance to the next subobject name.
142142
Prefix.resize(Size); // Erase any designator we appended.
143143
});
144-
if (llvm::isa<ImplicitValueInitExpr>(Init))
145-
continue; // a "hole" for a subobject that was not explicitly initialized
144+
// Skip for a broken initializer or if it is a "hole" in a subobject that
145+
// was not explicitly initialized.
146+
if (!Init || llvm::isa<ImplicitValueInitExpr>(Init))
147+
continue;
146148

147149
const auto *BraceElidedSubobject = llvm::dyn_cast<InitListExpr>(Init);
148150
if (BraceElidedSubobject &&

0 commit comments

Comments
 (0)