Skip to content

Commit 2c5af09

Browse files
committed
Merge commit 'd66dbd6931a4358c0e4fd7c749179aa229fb36a4' into llvmspirv_pulldown
2 parents ac45d7a + d66dbd6 commit 2c5af09

File tree

1,407 files changed

+30240
-29631
lines changed

Some content is hidden

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

1,407 files changed

+30240
-29631
lines changed

.ci/metrics/metrics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
# Lists the Github workflows we want to track. Maps the Github job name to
2222
# the metric name prefix in grafana.
2323
# This metric name is also used as a key in the job->name map.
24-
GITHUB_WORKFLOW_TO_TRACK = {"LLVM Premerge Checks": "github_llvm_premerge_checks"}
24+
GITHUB_WORKFLOW_TO_TRACK = {"CI Checks": "github_llvm_premerge_checks"}
2525

2626
# Lists the Github jobs to track for a given workflow. The key is the stable
2727
# name (metric name) of the workflow (see GITHUB_WORKFLOW_TO_TRACK).
2828
# Each value is a map to link the github job name to the corresponding metric
2929
# name.
3030
GITHUB_JOB_TO_TRACK = {
3131
"github_llvm_premerge_checks": {
32-
"Linux Premerge Checks (Test Only - Please Ignore Results)": "premerge_linux",
33-
"Windows Premerge Checks (Test Only - Please Ignore Results)": "premerge_windows",
32+
"Build and Test Linux (Test Only - Please Ignore Results)": "premerge_linux",
33+
"Build and Test Windows (Test Only - Please Ignore Results)": "premerge_windows",
3434
}
3535
}
3636

.github/workflows/libcxx-build-and-test.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
3939
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
40+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
4141
continue-on-error: false
4242
strategy:
4343
fail-fast: false
@@ -75,7 +75,7 @@ jobs:
7575
stage2:
7676
if: github.repository_owner == 'llvm'
7777
runs-on: libcxx-self-hosted-linux
78-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
78+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
7979
needs: [ stage1 ]
8080
continue-on-error: false
8181
strategy:
@@ -163,7 +163,7 @@ jobs:
163163
- config: 'generic-msan'
164164
machine: libcxx-self-hosted-linux
165165
runs-on: ${{ matrix.machine }}
166-
container: ghcr.io/llvm/libcxx-linux-builder:b6bb9dc5abd7c6452c13a53fa8949cb259db459b
166+
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
167167
steps:
168168
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
169169
- name: ${{ matrix.config }}

.github/workflows/premerge.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: LLVM Premerge Checks
1+
name: CI Checks
22

33
permissions:
44
contents: read
@@ -25,7 +25,7 @@ concurrency:
2525

2626
jobs:
2727
premerge-checks-linux:
28-
name: Linux Premerge Checks (Test Only - Please Ignore Results)
28+
name: Build and Test Linux (Test Only - Please Ignore Results)
2929
if: >-
3030
github.repository_owner == 'llvm' &&
3131
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -74,7 +74,7 @@ jobs:
7474
include-hidden-files: 'true'
7575

7676
premerge-checks-windows:
77-
name: Windows Premerge Checks (Test Only - Please Ignore Results)
77+
name: Build and Test Windows (Test Only - Please Ignore Results)
7878
if: >-
7979
github.repository_owner == 'llvm' &&
8080
(github.event_name != 'pull_request' || github.event.action != 'closed')

bolt/lib/Passes/PatchEntries.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,10 @@ Error PatchEntries::runOnFunctions(BinaryContext &BC) {
9898
});
9999

100100
if (!Success) {
101-
// We can't change output layout for AArch64 due to LongJmp pass
102-
if (BC.isAArch64()) {
103-
if (opts::ForcePatch) {
104-
BC.errs() << "BOLT-ERROR: unable to patch entries in " << Function
105-
<< "\n";
106-
return createFatalBOLTError("");
107-
}
108-
109-
continue;
110-
}
111-
112101
// If the original function entries cannot be patched, then we cannot
113102
// safely emit new function body.
114103
BC.errs() << "BOLT-WARNING: failed to patch entries in " << Function
115-
<< ". The function will not be optimized.\n";
104+
<< ". The function will not be optimized\n";
116105
Function.setIgnored();
117106
continue;
118107
}

bolt/lib/Rewrite/BinaryPassManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
497497
// memory profiling data.
498498
Manager.registerPass(std::make_unique<ReorderData>());
499499

500+
// Patch original function entries
501+
if (BC.HasRelocations)
502+
Manager.registerPass(std::make_unique<PatchEntries>());
503+
500504
if (BC.isAArch64()) {
501505
Manager.registerPass(
502506
std::make_unique<ADRRelaxationPass>(PrintAdrRelaxation));
@@ -524,10 +528,6 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
524528
// Assign each function an output section.
525529
Manager.registerPass(std::make_unique<AssignSections>());
526530

527-
// Patch original function entries
528-
if (BC.HasRelocations)
529-
Manager.registerPass(std::make_unique<PatchEntries>());
530-
531531
// This pass turns tail calls into jumps which makes them invisible to
532532
// function reordering. It's unsafe to use any CFG or instruction analysis
533533
// after this point.

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

+11-10
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,12 @@ SlabTuple indexSymbols(ASTContext &AST, Preprocessor &PP,
4848
const MainFileMacros *MacroRefsToIndex,
4949
const include_cleaner::PragmaIncludes &PI,
5050
bool IsIndexMainAST, llvm::StringRef Version,
51-
bool CollectMainFileRefs) {
51+
bool CollectMainFileRefs, SymbolOrigin Origin) {
5252
SymbolCollector::Options CollectorOpts;
5353
CollectorOpts.CollectIncludePath = true;
5454
CollectorOpts.PragmaIncludes = &PI;
5555
CollectorOpts.CountReferences = false;
56-
CollectorOpts.Origin =
57-
IsIndexMainAST ? SymbolOrigin::Open : SymbolOrigin::Preamble;
56+
CollectorOpts.Origin = Origin;
5857
CollectorOpts.CollectMainFileRefs = CollectMainFileRefs;
5958
// We want stdlib implementation details in the index only if we've opened the
6059
// file in question. This does means xrefs won't work, though.
@@ -221,22 +220,24 @@ FileShardedIndex::getShard(llvm::StringRef Uri) const {
221220
}
222221

223222
SlabTuple indexMainDecls(ParsedAST &AST) {
224-
return indexSymbols(
225-
AST.getASTContext(), AST.getPreprocessor(), AST.getLocalTopLevelDecls(),
226-
&AST.getMacros(), AST.getPragmaIncludes(),
227-
/*IsIndexMainAST=*/true, AST.version(), /*CollectMainFileRefs=*/true);
223+
return indexSymbols(AST.getASTContext(), AST.getPreprocessor(),
224+
AST.getLocalTopLevelDecls(), &AST.getMacros(),
225+
AST.getPragmaIncludes(),
226+
/*IsIndexMainAST=*/true, AST.version(),
227+
/*CollectMainFileRefs=*/true, SymbolOrigin::Open);
228228
}
229229

230230
SlabTuple indexHeaderSymbols(llvm::StringRef Version, ASTContext &AST,
231231
Preprocessor &PP,
232-
const include_cleaner::PragmaIncludes &PI) {
232+
const include_cleaner::PragmaIncludes &PI,
233+
SymbolOrigin Origin) {
233234
std::vector<Decl *> DeclsToIndex(
234235
AST.getTranslationUnitDecl()->decls().begin(),
235236
AST.getTranslationUnitDecl()->decls().end());
236237
return indexSymbols(AST, PP, DeclsToIndex,
237238
/*MainFileMacros=*/nullptr, PI,
238239
/*IsIndexMainAST=*/false, Version,
239-
/*CollectMainFileRefs=*/false);
240+
/*CollectMainFileRefs=*/false, Origin);
240241
}
241242

242243
FileSymbols::FileSymbols(IndexContents IdxContents, bool SupportContainedRefs)
@@ -462,7 +463,7 @@ void FileIndex::updatePreamble(PathRef Path, llvm::StringRef Version,
462463
const include_cleaner::PragmaIncludes &PI) {
463464
IndexFileIn IF;
464465
std::tie(IF.Symbols, std::ignore, IF.Relations) =
465-
indexHeaderSymbols(Version, AST, PP, PI);
466+
indexHeaderSymbols(Version, AST, PP, PI, SymbolOrigin::Preamble);
466467
updatePreamble(std::move(IF));
467468
}
468469

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ SlabTuple indexMainDecls(ParsedAST &AST);
164164
/// included headers.
165165
SlabTuple indexHeaderSymbols(llvm::StringRef Version, ASTContext &AST,
166166
Preprocessor &PP,
167-
const include_cleaner::PragmaIncludes &PI);
167+
const include_cleaner::PragmaIncludes &PI,
168+
SymbolOrigin Origin);
168169

169170
/// Takes slabs coming from a TU (multiple files) and shards them per
170171
/// declaration location.

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

+18-19
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
#include "Compiler.h"
1616
#include "Config.h"
1717
#include "SymbolCollector.h"
18+
#include "clang-include-cleaner/Record.h"
19+
#include "index/FileIndex.h"
1820
#include "index/IndexAction.h"
1921
#include "support/Logger.h"
2022
#include "support/ThreadsafeFS.h"
2123
#include "support/Trace.h"
2224
#include "clang/Basic/LangOptions.h"
2325
#include "clang/Frontend/CompilerInvocation.h"
26+
#include "clang/Frontend/FrontendActions.h"
2427
#include "clang/Lex/PreprocessorOptions.h"
2528
#include "clang/Tooling/Inclusions/StandardLibrary.h"
2629
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -223,33 +226,29 @@ SymbolSlab indexStandardLibrary(llvm::StringRef HeaderSources,
223226
return Symbols;
224227
}
225228

226-
SymbolCollector::Options IndexOpts;
227-
IndexOpts.Origin = SymbolOrigin::StdLib;
228-
IndexOpts.CollectMainFileSymbols = false;
229-
IndexOpts.CollectMainFileRefs = false;
230-
IndexOpts.CollectMacro = true;
231-
IndexOpts.StoreAllDocumentation = true;
232-
// Sadly we can't use IndexOpts.FileFilter to restrict indexing scope.
233-
// Files from outside the StdLibLocation may define true std symbols anyway.
234-
// We end up "blessing" such headers, and can only do that by indexing
235-
// everything first.
236-
237-
// Refs, relations, include graph in the stdlib mostly aren't useful.
238-
auto Action = createStaticIndexingAction(
239-
IndexOpts, [&](SymbolSlab S) { Symbols = std::move(S); }, nullptr,
240-
nullptr, nullptr);
241-
242-
if (!Action->BeginSourceFile(*Clang, Input)) {
229+
SyntaxOnlyAction Action;
230+
231+
if (!Action.BeginSourceFile(*Clang, Input)) {
243232
elog("Standard Library Index: BeginSourceFile() failed");
244233
return Symbols;
245234
}
246235

247-
if (llvm::Error Err = Action->Execute()) {
236+
if (llvm::Error Err = Action.Execute()) {
248237
elog("Standard Library Index: Execute failed: {0}", std::move(Err));
249238
return Symbols;
250239
}
251240

252-
Action->EndSourceFile();
241+
// We don't care about include graph for stdlib headers, so provide a no-op
242+
// PI.
243+
include_cleaner::PragmaIncludes PI;
244+
auto Slabs =
245+
indexHeaderSymbols("", Clang->getASTContext(), Clang->getPreprocessor(),
246+
PI, SymbolOrigin::StdLib);
247+
Symbols = std::move(std::get<0>(Slabs));
248+
249+
// Run EndSourceFile() after indexing completes, so ensure the AST and
250+
// preprocessor state is alive during indexing.
251+
Action.EndSourceFile();
253252

254253
unsigned SymbolsBeforeFilter = Symbols.size();
255254
Symbols = filter(std::move(Symbols), Loc);

clang-tools-extra/clangd/unittests/StdLibTests.cpp

+48
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
#include "Config.h"
1414
#include "SyncAPI.h"
1515
#include "TestFS.h"
16+
#include "index/Index.h"
1617
#include "index/StdLib.h"
1718
#include "clang/Basic/LangOptions.h"
1819
#include "clang/Basic/SourceManager.h"
20+
#include "llvm/Testing/Support/Error.h"
1921
#include "gmock/gmock.h"
2022
#include "gtest/gtest.h"
2123
#include <memory>
@@ -158,6 +160,52 @@ TEST(StdLibTests, EndToEnd) {
158160
UnorderedElementsAre(StdlibSymbol("list"), StdlibSymbol("vector")));
159161
}
160162

163+
TEST(StdLibTests, StdLibDocComments) {
164+
Config Cfg;
165+
Cfg.Index.StandardLibrary = true;
166+
WithContextValue Enabled(Config::Key, std::move(Cfg));
167+
168+
MockFS FS;
169+
FS.Files["stdlib/vector"] = R"cpp(
170+
namespace std {
171+
struct vector {
172+
/**doc comment*/
173+
struct inner {};
174+
};
175+
}
176+
)cpp";
177+
MockCompilationDatabase CDB;
178+
CDB.ExtraClangFlags.push_back("-isystem" + testPath("stdlib"));
179+
ClangdServer::Options Opts = ClangdServer::optsForTest();
180+
Opts.BuildDynamicSymbolIndex = true; // also used for stdlib index
181+
ClangdServer Server(CDB, FS, Opts);
182+
183+
// Open an empty file. <vector> will not be part of the preamble index,
184+
// but it will be part of the stdlib index.
185+
Server.addDocument(testPath("foo.cc"), "");
186+
187+
// Wait for the stdlib index to be built.
188+
ASSERT_TRUE(Server.blockUntilIdleForTest());
189+
190+
// Check that the index contains the doc comment.
191+
SymbolSlab Result;
192+
EXPECT_THAT_ERROR(runCustomAction(Server, testPath("foo.cc"),
193+
[&](InputsAndAST Inputs) {
194+
FuzzyFindRequest Req;
195+
Req.Query = "inner";
196+
Req.Scopes = {"std::vector::"};
197+
SymbolSlab::Builder Builder;
198+
Inputs.Inputs.Index->fuzzyFind(
199+
Req, [&](const Symbol &Sym) {
200+
Builder.insert(Sym);
201+
});
202+
Result = std::move(Builder).build();
203+
}),
204+
llvm::Succeeded());
205+
ASSERT_EQ(Result.size(), 1u);
206+
EXPECT_EQ(Result.begin()->Documentation, "doc comment");
207+
}
208+
161209
} // namespace
162210
} // namespace clangd
163211
} // namespace clang

clang-tools-extra/clangd/unittests/TestTU.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "Diagnostics.h"
1313
#include "TestFS.h"
1414
#include "index/FileIndex.h"
15+
#include "index/SymbolOrigin.h"
1516
#include "clang/AST/RecursiveASTVisitor.h"
1617
#include "clang/Basic/Diagnostic.h"
1718
#include "clang/Frontend/CompilerInvocation.h"
@@ -164,7 +165,7 @@ SymbolSlab TestTU::headerSymbols() const {
164165
auto AST = build();
165166
return std::get<0>(indexHeaderSymbols(
166167
/*Version=*/"null", AST.getASTContext(), AST.getPreprocessor(),
167-
AST.getPragmaIncludes()));
168+
AST.getPragmaIncludes(), SymbolOrigin::Preamble));
168169
}
169170

170171
RefSlab TestTU::headerRefs() const {

clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Calls to the following std library algorithms are checked:
6464
``std::mismatch``,
6565
``std::next_permutation``,
6666
``std::none_of``,
67-
``std::parital_sum``,
67+
``std::partial_sum``,
6868
``std::partial_sort_copy``,
6969
``std::partition_copy``,
7070
``std::partition_point``,

clang-tools-extra/docs/clang-tidy/checks/bugprone/casting-through-void.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Note: it is expected that, after applying the suggested fix and using
2626
<../cppcoreguidelines/pro-type-reinterpret-cast>` will emit a warning.
2727
This is intentional: ``reinterpret_cast`` is a dangerous operation that can
2828
easily break the strict aliasing rules when dereferencing the casted pointer,
29-
invoking Undefined Behavior. The warning is there to prompt users to carefuly
29+
invoking Undefined Behavior. The warning is there to prompt users to carefully
3030
analyze whether the usage of ``reinterpret_cast`` is safe, in which case the
3131
warning may be suppressed.
3232

clang/bindings/python/clang/cindex.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ def binary_operator(self):
18871887
"""
18881888

18891889
if not hasattr(self, "_binopcode"):
1890-
self._binopcode = conf.lib.clang_Cursor_getBinaryOpcode(self)
1890+
self._binopcode = conf.lib.clang_getCursorBinaryOperatorKind(self)
18911891

18921892
return BinaryOperator.from_id(self._binopcode)
18931893

@@ -2980,11 +2980,7 @@ def availability(self):
29802980

29812981
@property
29822982
def briefComment(self):
2983-
if conf.function_exists("clang_getCompletionBriefComment"):
2984-
return _CXString.from_result(
2985-
conf.lib.clang_getCompletionBriefComment(self.obj)
2986-
)
2987-
return ""
2983+
return _CXString.from_result(conf.lib.clang_getCompletionBriefComment(self.obj))
29882984

29892985
def __repr__(self):
29902986
return (
@@ -4101,7 +4097,7 @@ def set_property(self, property, value):
41014097
("clang_Cursor_getTemplateArgumentType", [Cursor, c_uint], Type),
41024098
("clang_Cursor_getTemplateArgumentValue", [Cursor, c_uint], c_longlong),
41034099
("clang_Cursor_getTemplateArgumentUnsignedValue", [Cursor, c_uint], c_ulonglong),
4104-
("clang_Cursor_getBinaryOpcode", [Cursor], c_int),
4100+
("clang_getCursorBinaryOperatorKind", [Cursor], c_int),
41054101
("clang_Cursor_getBriefCommentText", [Cursor], _CXString),
41064102
("clang_Cursor_getRawCommentText", [Cursor], _CXString),
41074103
("clang_Cursor_getOffsetOfField", [Cursor], c_longlong),
@@ -4264,14 +4260,6 @@ def get_cindex_library(self) -> CDLL:
42644260

42654261
return library
42664262

4267-
def function_exists(self, name: str) -> bool:
4268-
try:
4269-
getattr(self.lib, name)
4270-
except AttributeError:
4271-
return False
4272-
4273-
return True
4274-
42754263

42764264
conf = Config()
42774265

0 commit comments

Comments
 (0)