Skip to content

Commit e011a7b

Browse files
committed
merge main into amd-staging
Change-Id: I4cdc2a125ad25a70b8a0cbe38fde351698a401da
2 parents d3eebcd + af4ae12 commit e011a7b

File tree

346 files changed

+14236
-12676
lines changed

Some content is hidden

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

346 files changed

+14236
-12676
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ jobs:
148148
cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
149149
TZ=UTC ninja -C libunwind-build docs-libunwind-html
150150
mkdir built-docs/libunwind
151-
cp -r libunwind-build/docs/* built-docs/libunwind
151+
cp -r libunwind-build/libunwind/docs/* built-docs/libunwind
152152
- name: Build libcxx docs
153153
if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true'
154154
run: |
155155
cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx;libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
156156
TZ=UTC ninja -C libcxx-build docs-libcxx-html
157157
mkdir built-docs/libcxx
158-
cp -r libcxx-build/docs/* built-docs/libcxx/
158+
cp -r libcxx-build/libcxx/docs/* built-docs/libcxx/
159159
- name: Build libc docs
160160
if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true'
161161
run: |

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,91 @@ jobs:
130130
run_id: context.payload.workflow_run.id
131131
})
132132
await create_check_run('success', 'Restarted workflow run due to preempted job')
133+
134+
restart-test:
135+
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled') && github.event.actor.login == 'ldionne' # TESTING ONLY
136+
name: "Restart Job"
137+
permissions:
138+
statuses: read
139+
checks: write
140+
actions: write
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: "Restart Job"
144+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
145+
with:
146+
script: |
147+
const FAILURE_REGEX = /Process completed with exit code 1./
148+
const PREEMPTION_REGEX = /The runner has received a shutdown signal|The operation was canceled/
149+
150+
function log(msg) {
151+
core.notice(msg)
152+
}
153+
154+
const wf_run = context.payload.workflow_run
155+
log(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)
156+
157+
log('Listing check runs for suite')
158+
const check_suites = await github.rest.checks.listForSuite({
159+
owner: context.repo.owner,
160+
repo: context.repo.repo,
161+
check_suite_id: context.payload.workflow_run.check_suite_id,
162+
per_page: 100 // FIXME: We don't have 100 check runs yet, but we should handle this better.
163+
})
164+
165+
preemptions = [];
166+
legitimate_failures = [];
167+
for (check_run of check_suites.data.check_runs) {
168+
log(`Checking check run: ${check_run.id}`);
169+
if (check_run.status != 'completed') {
170+
log('Check run was not completed. Skipping.');
171+
continue;
172+
}
173+
174+
if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') {
175+
log(`Check run had conclusion: ${check_run.conclusion}. Skipping.`);
176+
continue;
177+
}
178+
179+
annotations = await github.rest.checks.listAnnotations({
180+
owner: context.repo.owner,
181+
repo: context.repo.repo,
182+
check_run_id: check_run.id
183+
})
184+
185+
preemption_annotation = annotations.data.find(function(annotation) {
186+
return annotation.annotation_level == 'failure' &&
187+
annotation.message.match(PREEMPTION_REGEX) != null;
188+
});
189+
if (preemption_annotation != null) {
190+
log(`Found preemption message: ${preemption_annotation.message}`);
191+
preemptions.push(check_run);
192+
break;
193+
}
194+
195+
failure_annotation = annotations.data.find(function(annotation) {
196+
return annotation.annotation_level == 'failure' &&
197+
annotation.message.match(FAILURE_REGEX) != null;
198+
});
199+
if (failure_annotation != null) {
200+
log(`Found legitimate failure annotation: ${failure_annotation.message}`);
201+
legitimate_failures.push(check_run);
202+
break;
203+
}
204+
}
205+
206+
if (preemptions) {
207+
log('Found some preempted jobs');
208+
if (legitimate_failures) {
209+
log('Also found some legitimate failures, so not restarting the workflow.');
210+
} else {
211+
log('Did not find any legitimate failures. Restarting workflow.');
212+
await github.rest.actions.reRunWorkflowFailedJobs({
213+
owner: context.repo.owner,
214+
repo: context.repo.repo,
215+
run_id: context.payload.workflow_run.id
216+
})
217+
}
218+
} else {
219+
log('Did not find any preempted jobs. Not restarting the workflow.');
220+
}

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,12 +1415,6 @@ void ClangdLSPServer::onInlayHint(const InlayHintsParams &Params,
14151415
std::move(Reply));
14161416
}
14171417

1418-
void ClangdLSPServer::onCallHierarchyOutgoingCalls(
1419-
const CallHierarchyOutgoingCallsParams &Params,
1420-
Callback<std::vector<CallHierarchyOutgoingCall>> Reply) {
1421-
Server->outgoingCalls(Params.item, std::move(Reply));
1422-
}
1423-
14241418
void ClangdLSPServer::applyConfiguration(
14251419
const ConfigurationSettings &Settings) {
14261420
// Per-file update to the compilation database.
@@ -1699,8 +1693,6 @@ void ClangdLSPServer::bindMethods(LSPBinder &Bind,
16991693
Bind.method("typeHierarchy/subtypes", this, &ClangdLSPServer::onSubTypes);
17001694
Bind.method("textDocument/prepareCallHierarchy", this, &ClangdLSPServer::onPrepareCallHierarchy);
17011695
Bind.method("callHierarchy/incomingCalls", this, &ClangdLSPServer::onCallHierarchyIncomingCalls);
1702-
if (Opts.EnableOutgoingCalls)
1703-
Bind.method("callHierarchy/outgoingCalls", this, &ClangdLSPServer::onCallHierarchyOutgoingCalls);
17041696
Bind.method("textDocument/selectionRange", this, &ClangdLSPServer::onSelectionRange);
17051697
Bind.method("textDocument/documentLink", this, &ClangdLSPServer::onDocumentLink);
17061698
Bind.method("textDocument/semanticTokens/full", this, &ClangdLSPServer::onSemanticTokens);

clang-tools-extra/clangd/ClangdLSPServer.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ class ClangdLSPServer : private ClangdServer::Callbacks,
156156
void onCallHierarchyIncomingCalls(
157157
const CallHierarchyIncomingCallsParams &,
158158
Callback<std::vector<CallHierarchyIncomingCall>>);
159-
void onCallHierarchyOutgoingCalls(
160-
const CallHierarchyOutgoingCallsParams &,
161-
Callback<std::vector<CallHierarchyOutgoingCall>>);
162159
void onClangdInlayHints(const InlayHintsParams &,
163160
Callback<llvm::json::Value>);
164161
void onInlayHint(const InlayHintsParams &, Callback<std::vector<InlayHint>>);

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,7 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
215215
const ThreadsafeFS &TFS, const Options &Opts,
216216
Callbacks *Callbacks)
217217
: FeatureModules(Opts.FeatureModules), CDB(CDB), TFS(TFS),
218-
DynamicIdx(Opts.BuildDynamicSymbolIndex
219-
? new FileIndex(Opts.EnableOutgoingCalls)
220-
: nullptr),
218+
DynamicIdx(Opts.BuildDynamicSymbolIndex ? new FileIndex() : nullptr),
221219
ModulesManager(Opts.ModulesManager),
222220
ClangTidyProvider(Opts.ClangTidyProvider),
223221
UseDirtyHeaders(Opts.UseDirtyHeaders),
@@ -258,7 +256,6 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
258256
Callbacks->onBackgroundIndexProgress(S);
259257
};
260258
BGOpts.ContextProvider = Opts.ContextProvider;
261-
BGOpts.SupportContainedRefs = Opts.EnableOutgoingCalls;
262259
BackgroundIdx = std::make_unique<BackgroundIndex>(
263260
TFS, CDB,
264261
BackgroundIndexStorage::createDiskBackedStorageFactory(
@@ -915,15 +912,6 @@ void ClangdServer::inlayHints(PathRef File, std::optional<Range> RestrictRange,
915912
WorkScheduler->runWithAST("InlayHints", File, std::move(Action), Transient);
916913
}
917914

918-
void ClangdServer::outgoingCalls(
919-
const CallHierarchyItem &Item,
920-
Callback<std::vector<CallHierarchyOutgoingCall>> CB) {
921-
WorkScheduler->run("Outgoing Calls", "",
922-
[CB = std::move(CB), Item, this]() mutable {
923-
CB(clangd::outgoingCalls(Item, Index));
924-
});
925-
}
926-
927915
void ClangdServer::onFileEvent(const DidChangeWatchedFilesParams &Params) {
928916
// FIXME: Do nothing for now. This will be used for indexing and potentially
929917
// invalidating other caches.

clang-tools-extra/clangd/ClangdServer.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ class ClangdServer {
110110
/// Cached preambles are potentially large. If false, store them on disk.
111111
bool StorePreamblesInMemory = true;
112112

113-
/// Call hierarchy's outgoing calls feature requires additional index
114-
/// serving structures which increase memory usage. If false, these are
115-
/// not created and the feature is not enabled.
116-
bool EnableOutgoingCalls = true;
117-
118113
/// This throttler controls which preambles may be built at a given time.
119114
clangd::PreambleThrottler *PreambleThrottler = nullptr;
120115

@@ -297,10 +292,6 @@ class ClangdServer {
297292
void incomingCalls(const CallHierarchyItem &Item,
298293
Callback<std::vector<CallHierarchyIncomingCall>>);
299294

300-
/// Resolve outgoing calls for a given call hierarchy item.
301-
void outgoingCalls(const CallHierarchyItem &Item,
302-
Callback<std::vector<CallHierarchyOutgoingCall>>);
303-
304295
/// Resolve inlay hints for a given document.
305296
void inlayHints(PathRef File, std::optional<Range> RestrictRange,
306297
Callback<std::vector<InlayHint>>);

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,6 @@ declToHierarchyItem(const NamedDecl &ND, llvm::StringRef TUPath) {
17021702

17031703
HierarchyItem HI;
17041704
HI.name = printName(Ctx, ND);
1705-
// FIXME: Populate HI.detail the way we do in symbolToHierarchyItem?
17061705
HI.kind = SK;
17071706
HI.range = Range{sourceLocToPosition(SM, DeclRange->getBegin()),
17081707
sourceLocToPosition(SM, DeclRange->getEnd())};
@@ -1754,7 +1753,6 @@ static std::optional<HierarchyItem> symbolToHierarchyItem(const Symbol &S,
17541753
}
17551754
HierarchyItem HI;
17561755
HI.name = std::string(S.Name);
1757-
HI.detail = (S.Scope + S.Name).str();
17581756
HI.kind = indexSymbolKindToSymbolKind(S.SymInfo.Kind);
17591757
HI.selectionRange = Loc->range;
17601758
// FIXME: Populate 'range' correctly
@@ -2321,65 +2319,6 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
23212319
return Results;
23222320
}
23232321

2324-
std::vector<CallHierarchyOutgoingCall>
2325-
outgoingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
2326-
std::vector<CallHierarchyOutgoingCall> Results;
2327-
if (!Index || Item.data.empty())
2328-
return Results;
2329-
auto ID = SymbolID::fromStr(Item.data);
2330-
if (!ID) {
2331-
elog("outgoingCalls failed to find symbol: {0}", ID.takeError());
2332-
return Results;
2333-
}
2334-
// In this function, we find outgoing calls based on the index only.
2335-
ContainedRefsRequest Request;
2336-
Request.ID = *ID;
2337-
// Initially store the ranges in a map keyed by SymbolID of the callee.
2338-
// This allows us to group different calls to the same function
2339-
// into the same CallHierarchyOutgoingCall.
2340-
llvm::DenseMap<SymbolID, std::vector<Range>> CallsOut;
2341-
// We can populate the ranges based on a refs request only. As we do so, we
2342-
// also accumulate the callee IDs into a lookup request.
2343-
LookupRequest CallsOutLookup;
2344-
Index->containedRefs(Request, [&](const auto &R) {
2345-
auto Loc = indexToLSPLocation(R.Location, Item.uri.file());
2346-
if (!Loc) {
2347-
elog("outgoingCalls failed to convert location: {0}", Loc.takeError());
2348-
return;
2349-
}
2350-
auto It = CallsOut.try_emplace(R.Symbol, std::vector<Range>{}).first;
2351-
It->second.push_back(Loc->range);
2352-
2353-
CallsOutLookup.IDs.insert(R.Symbol);
2354-
});
2355-
// Perform the lookup request and combine its results with CallsOut to
2356-
// get complete CallHierarchyOutgoingCall objects.
2357-
Index->lookup(CallsOutLookup, [&](const Symbol &Callee) {
2358-
// The containedRefs request should only return symbols which are
2359-
// function-like, i.e. symbols for which references to them can be "calls".
2360-
using SK = index::SymbolKind;
2361-
auto Kind = Callee.SymInfo.Kind;
2362-
assert(Kind == SK::Function || Kind == SK::InstanceMethod ||
2363-
Kind == SK::ClassMethod || Kind == SK::StaticMethod ||
2364-
Kind == SK::Constructor || Kind == SK::Destructor ||
2365-
Kind == SK::ConversionFunction);
2366-
(void)Kind;
2367-
(void)SK::Function;
2368-
2369-
auto It = CallsOut.find(Callee.ID);
2370-
assert(It != CallsOut.end());
2371-
if (auto CHI = symbolToCallHierarchyItem(Callee, Item.uri.file()))
2372-
Results.push_back(
2373-
CallHierarchyOutgoingCall{std::move(*CHI), std::move(It->second)});
2374-
});
2375-
// Sort results by name of the callee.
2376-
llvm::sort(Results, [](const CallHierarchyOutgoingCall &A,
2377-
const CallHierarchyOutgoingCall &B) {
2378-
return A.to.name < B.to.name;
2379-
});
2380-
return Results;
2381-
}
2382-
23832322
llvm::DenseSet<const Decl *> getNonLocalDeclRefs(ParsedAST &AST,
23842323
const FunctionDecl *FD) {
23852324
if (!FD->hasBody())

clang-tools-extra/clangd/XRefs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ prepareCallHierarchy(ParsedAST &AST, Position Pos, PathRef TUPath);
150150
std::vector<CallHierarchyIncomingCall>
151151
incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index);
152152

153-
std::vector<CallHierarchyOutgoingCall>
154-
outgoingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index);
155-
156153
/// Returns all decls that are referenced in the \p FD except local symbols.
157154
llvm::DenseSet<const Decl *> getNonLocalDeclRefs(ParsedAST &AST,
158155
const FunctionDecl *FD);

clang-tools-extra/clangd/index/Background.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ BackgroundIndex::BackgroundIndex(
9696
: SwapIndex(std::make_unique<MemIndex>()), TFS(TFS), CDB(CDB),
9797
IndexingPriority(Opts.IndexingPriority),
9898
ContextProvider(std::move(Opts.ContextProvider)),
99-
IndexedSymbols(IndexContents::All, Opts.SupportContainedRefs),
99+
IndexedSymbols(IndexContents::All),
100100
Rebuilder(this, &IndexedSymbols, Opts.ThreadPoolSize),
101101
IndexStorageFactory(std::move(IndexStorageFactory)),
102102
Queue(std::move(Opts.OnProgress)),

clang-tools-extra/clangd/index/Background.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ class BackgroundIndex : public SwapIndex {
145145
// file. Called with the empty string for other tasks.
146146
// (When called, the context from BackgroundIndex construction is active).
147147
std::function<Context(PathRef)> ContextProvider = nullptr;
148-
// Whether the index needs to support the containedRefs() operation.
149-
// May use extra memory.
150-
bool SupportContainedRefs = true;
151148
};
152149

153150
/// Creates a new background index and starts its threads.

clang-tools-extra/clangd/index/FileIndex.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ SlabTuple indexHeaderSymbols(llvm::StringRef Version, ASTContext &AST,
239239
/*CollectMainFileRefs=*/false);
240240
}
241241

242-
FileSymbols::FileSymbols(IndexContents IdxContents, bool SupportContainedRefs)
243-
: IdxContents(IdxContents), SupportContainedRefs(SupportContainedRefs) {}
242+
FileSymbols::FileSymbols(IndexContents IdxContents)
243+
: IdxContents(IdxContents) {}
244244

245245
void FileSymbols::update(llvm::StringRef Key,
246246
std::unique_ptr<SymbolSlab> Symbols,
@@ -395,7 +395,7 @@ FileSymbols::buildIndex(IndexType Type, DuplicateHandling DuplicateHandle,
395395
std::move(AllRelations), std::move(Files), IdxContents,
396396
std::make_tuple(std::move(SymbolSlabs), std::move(RefSlabs),
397397
std::move(RefsStorage), std::move(SymsStorage)),
398-
StorageSize, SupportContainedRefs);
398+
StorageSize);
399399
}
400400
llvm_unreachable("Unknown clangd::IndexType");
401401
}
@@ -419,12 +419,11 @@ void FileSymbols::profile(MemoryTree &MT) const {
419419
}
420420
}
421421

422-
FileIndex::FileIndex(bool SupportContainedRefs)
422+
FileIndex::FileIndex()
423423
: MergedIndex(&MainFileIndex, &PreambleIndex),
424-
PreambleSymbols(IndexContents::Symbols | IndexContents::Relations,
425-
SupportContainedRefs),
424+
PreambleSymbols(IndexContents::Symbols | IndexContents::Relations),
426425
PreambleIndex(std::make_unique<MemIndex>()),
427-
MainFileSymbols(IndexContents::All, SupportContainedRefs),
426+
MainFileSymbols(IndexContents::All),
428427
MainFileIndex(std::make_unique<MemIndex>()) {}
429428

430429
void FileIndex::updatePreamble(IndexFileIn IF) {

clang-tools-extra/clangd/index/FileIndex.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ enum class DuplicateHandling {
6969
/// locking when we swap or obtain references to snapshots.
7070
class FileSymbols {
7171
public:
72-
FileSymbols(IndexContents IdxContents, bool SupportContainedRefs);
72+
FileSymbols(IndexContents IdxContents);
7373
/// Updates all slabs associated with the \p Key.
7474
/// If either is nullptr, corresponding data for \p Key will be removed.
7575
/// If CountReferences is true, \p Refs will be used for counting references
@@ -91,7 +91,6 @@ class FileSymbols {
9191

9292
private:
9393
IndexContents IdxContents;
94-
bool SupportContainedRefs;
9594

9695
struct RefSlabAndCountReferences {
9796
std::shared_ptr<RefSlab> Slab;
@@ -109,7 +108,7 @@ class FileSymbols {
109108
/// FIXME: Expose an interface to remove files that are closed.
110109
class FileIndex : public MergedIndex {
111110
public:
112-
FileIndex(bool SupportContainedRefs);
111+
FileIndex();
113112

114113
/// Update preamble symbols of file \p Path with all declarations in \p AST
115114
/// and macros in \p PP.

clang-tools-extra/clangd/index/Index.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ bool SwapIndex::refs(const RefsRequest &R,
6666
llvm::function_ref<void(const Ref &)> CB) const {
6767
return snapshot()->refs(R, CB);
6868
}
69-
bool SwapIndex::containedRefs(
70-
const ContainedRefsRequest &R,
71-
llvm::function_ref<void(const ContainedRefsResult &)> CB) const {
72-
return snapshot()->containedRefs(R, CB);
73-
}
7469
void SwapIndex::relations(
7570
const RelationsRequest &R,
7671
llvm::function_ref<void(const SymbolID &, const Symbol &)> CB) const {

0 commit comments

Comments
 (0)