Skip to content

Commit 91d7d4e

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents 526701d + 7cd2a9f commit 91d7d4e

File tree

232 files changed

+10859
-4987
lines changed

Some content is hidden

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

232 files changed

+10859
-4987
lines changed

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ jobs:
216216
217217
- id: package-info
218218
run: |
219-
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
219+
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.xz"
220220
echo "filename=$filename" >> $GITHUB_OUTPUT
221221
echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
222222

clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,15 @@ class CyclicDependencyCallbacks : public PPCallbacks {
130130
<< FileName;
131131

132132
const bool IsIncludePathValid =
133-
std::all_of(Files.rbegin(), It, [](const Include &Elem) {
133+
std::all_of(Files.rbegin(), It + 1, [](const Include &Elem) {
134134
return !Elem.Name.empty() && Elem.Loc.isValid();
135135
});
136-
137136
if (!IsIncludePathValid)
138137
return;
139138

140-
auto CurrentIt = Files.rbegin();
141-
do {
142-
if (CurrentIt->Loc.isValid())
143-
Check.diag(CurrentIt->Loc, "'%0' included from here",
144-
DiagnosticIDs::Note)
145-
<< CurrentIt->Name;
146-
} while (CurrentIt++ != It);
139+
for (const Include &I : llvm::make_range(Files.rbegin(), It + 1))
140+
Check.diag(I.Loc, "'%0' included from here", DiagnosticIDs::Note)
141+
<< I.Name;
147142
}
148143

149144
bool isFileIgnored(StringRef FileName) const {

clang-tools-extra/clangd/FindSymbols.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class DocumentOutline {
454454
if (!MacroName.isValid() || !MacroName.isFileID())
455455
continue;
456456
// All conditions satisfied, add the macro.
457-
if (auto *Tok = AST.getTokens().spelledTokenAt(MacroName))
457+
if (auto *Tok = AST.getTokens().spelledTokenContaining(MacroName))
458458
CurParent = &CurParent->inMacro(
459459
*Tok, SM, AST.getTokens().expansionStartingAt(Tok));
460460
}

clang-tools-extra/clangd/IncludeCleaner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ collectMacroReferences(ParsedAST &AST) {
303303
for (const auto &[_, Refs] : AST.getMacros().MacroRefs) {
304304
for (const auto &Ref : Refs) {
305305
auto Loc = SM.getComposedLoc(SM.getMainFileID(), Ref.StartOffset);
306-
const auto *Tok = AST.getTokens().spelledTokenAt(Loc);
306+
const auto *Tok = AST.getTokens().spelledTokenContaining(Loc);
307307
if (!Tok)
308308
continue;
309309
auto Macro = locateMacroAt(*Tok, PP);

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,10 @@ class HighlightingsBuilder {
447447
if (!RLoc.isValid())
448448
return;
449449

450-
const auto *RTok = TB.spelledTokenAt(RLoc);
451-
// Handle `>>`. RLoc is always pointing at the right location, just change
452-
// the end to be offset by 1.
453-
// We'll either point at the beginning of `>>`, hence get a proper spelled
454-
// or point in the middle of `>>` hence get no spelled tok.
450+
const auto *RTok = TB.spelledTokenContaining(RLoc);
451+
// Handle `>>`. RLoc is either part of `>>` or a spelled token on its own
452+
// `>`. If it's the former, slice to have length of 1, if latter use the
453+
// token as-is.
455454
if (!RTok || RTok->kind() == tok::greatergreater) {
456455
Position Begin = sourceLocToPosition(SourceMgr, RLoc);
457456
Position End = sourceLocToPosition(SourceMgr, RLoc.getLocWithOffset(1));
@@ -577,7 +576,7 @@ class HighlightingsBuilder {
577576
return std::nullopt;
578577
// We might have offsets in the main file that don't correspond to any
579578
// spelled tokens.
580-
const auto *Tok = TB.spelledTokenAt(Loc);
579+
const auto *Tok = TB.spelledTokenContaining(Loc);
581580
if (!Tok)
582581
return std::nullopt;
583582
return halfOpenToRange(SourceMgr,

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ std::vector<DocumentLink> getDocumentLinks(ParsedAST &AST) {
844844
if (Inc.Resolved.empty())
845845
continue;
846846
auto HashLoc = SM.getComposedLoc(SM.getMainFileID(), Inc.HashOffset);
847-
const auto *HashTok = AST.getTokens().spelledTokenAt(HashLoc);
847+
const auto *HashTok = AST.getTokens().spelledTokenContaining(HashLoc);
848848
assert(HashTok && "got inclusion at wrong offset");
849849
const auto *IncludeTok = std::next(HashTok);
850850
const auto *FileTok = std::next(IncludeTok);
@@ -938,7 +938,7 @@ class ReferenceFinder : public index::IndexDataConsumer {
938938
CollectorOpts.CollectMainFileSymbols = true;
939939
for (SourceLocation L : Locs) {
940940
L = SM.getFileLoc(L);
941-
if (const auto *Tok = TB.spelledTokenAt(L))
941+
if (const auto *Tok = TB.spelledTokenContaining(L))
942942
References.push_back(
943943
{*Tok, Roles,
944944
SymbolCollector::getRefContainer(ASTNode.Parent, CollectorOpts)});
@@ -1216,7 +1216,7 @@ DocumentHighlight toHighlight(const ReferenceFinder::Reference &Ref,
12161216
std::optional<DocumentHighlight> toHighlight(SourceLocation Loc,
12171217
const syntax::TokenBuffer &TB) {
12181218
Loc = TB.sourceManager().getFileLoc(Loc);
1219-
if (const auto *Tok = TB.spelledTokenAt(Loc)) {
1219+
if (const auto *Tok = TB.spelledTokenContaining(Loc)) {
12201220
DocumentHighlight Result;
12211221
Result.range = halfOpenToRange(
12221222
TB.sourceManager(),
@@ -1353,7 +1353,8 @@ maybeFindIncludeReferences(ParsedAST &AST, Position Pos,
13531353
Loc = SM.getIncludeLoc(SM.getFileID(Loc));
13541354

13551355
ReferencesResult::Reference Result;
1356-
const auto *Token = AST.getTokens().spelledTokenAt(Loc);
1356+
const auto *Token = AST.getTokens().spelledTokenContaining(Loc);
1357+
assert(Token && "references expected token here");
13571358
Result.Loc.range = Range{sourceLocToPosition(SM, Token->location()),
13581359
sourceLocToPosition(SM, Token->endLocation())};
13591360
Result.Loc.uri = URIMainFile;

clang-tools-extra/clangd/refactor/Rename.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ std::vector<SymbolRange> collectRenameIdentifierRanges(
748748
clangd::Range tokenRangeForLoc(ParsedAST &AST, SourceLocation TokLoc,
749749
const SourceManager &SM,
750750
const LangOptions &LangOpts) {
751-
const auto *Token = AST.getTokens().spelledTokenAt(TokLoc);
751+
const auto *Token = AST.getTokens().spelledTokenContaining(TokLoc);
752752
assert(Token && "rename expects spelled tokens");
753753
clangd::Range Result;
754754
Result.start = sourceLocToPosition(SM, Token->location());

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ TEST(PreamblePatchTest, LocateMacroAtWorks) {
417417
ASSERT_TRUE(AST);
418418

419419
const auto &SM = AST->getSourceManager();
420-
auto *MacroTok = AST->getTokens().spelledTokenAt(
420+
auto *MacroTok = AST->getTokens().spelledTokenContaining(
421421
SM.getComposedLoc(SM.getMainFileID(), Modified.point("use")));
422422
ASSERT_TRUE(MacroTok);
423423

@@ -441,7 +441,7 @@ TEST(PreamblePatchTest, LocateMacroAtDeletion) {
441441
ASSERT_TRUE(AST);
442442

443443
const auto &SM = AST->getSourceManager();
444-
auto *MacroTok = AST->getTokens().spelledTokenAt(
444+
auto *MacroTok = AST->getTokens().spelledTokenContaining(
445445
SM.getComposedLoc(SM.getMainFileID(), Modified.point()));
446446
ASSERT_TRUE(MacroTok);
447447

@@ -512,9 +512,10 @@ TEST(PreamblePatchTest, RefsToMacros) {
512512
ExpectedLocations.push_back(referenceRangeIs(R));
513513

514514
for (const auto &P : Modified.points()) {
515-
auto *MacroTok = AST->getTokens().spelledTokenAt(SM.getComposedLoc(
516-
SM.getMainFileID(),
517-
llvm::cantFail(positionToOffset(Modified.code(), P))));
515+
auto *MacroTok =
516+
AST->getTokens().spelledTokenContaining(SM.getComposedLoc(
517+
SM.getMainFileID(),
518+
llvm::cantFail(positionToOffset(Modified.code(), P))));
518519
ASSERT_TRUE(MacroTok);
519520
EXPECT_THAT(findReferences(*AST, P, 0).References,
520521
testing::ElementsAreArray(ExpectedLocations));

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2173,6 +2173,11 @@ TEST(FindReferences, WithinAST) {
21732173
using $def[[MyTypeD^ef]] = int;
21742174
enum MyEnum : $(MyEnum)[[MyTy^peDef]] { };
21752175
)cpp",
2176+
// UDL
2177+
R"cpp(
2178+
bool $decl[[operator]]"" _u^dl(unsigned long long value);
2179+
bool x = $(x)[[1_udl]];
2180+
)cpp",
21762181
};
21772182
for (const char *Test : Tests)
21782183
checkFindRefs(Test);
@@ -2358,7 +2363,13 @@ TEST(FindReferences, UsedSymbolsFromInclude) {
23582363

23592364
R"cpp([[#in^clude <vector>]]
23602365
std::[[vector]]<int> vec;
2361-
)cpp"};
2366+
)cpp",
2367+
2368+
R"cpp(
2369+
[[#include ^"udl_header.h"]]
2370+
auto x = [[1_b]];
2371+
)cpp",
2372+
};
23622373
for (const char *Test : Tests) {
23632374
Annotations T(Test);
23642375
auto TU = TestTU::withCode(T.code());
@@ -2375,6 +2386,9 @@ TEST(FindReferences, UsedSymbolsFromInclude) {
23752386
class vector{};
23762387
}
23772388
)cpp");
2389+
TU.AdditionalFiles["udl_header.h"] = guard(R"cpp(
2390+
bool operator"" _b(unsigned long long value);
2391+
)cpp");
23782392
TU.ExtraArgs.push_back("-isystem" + testPath("system"));
23792393

23802394
auto AST = TU.build();

clang/cmake/caches/Release.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,6 @@ endif()
9191
# Final Stage Config (stage2)
9292
set_final_stage_var(LLVM_ENABLE_RUNTIMES "${LLVM_RELEASE_ENABLE_RUNTIMES}" STRING)
9393
set_final_stage_var(LLVM_ENABLE_PROJECTS "${LLVM_RELEASE_ENABLE_PROJECTS}" STRING)
94+
set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
95+
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
9496

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ Arm and AArch64 Support
909909
* Arm Cortex-A520AE (cortex-a520ae).
910910
* Arm Cortex-A720AE (cortex-a720ae).
911911
* Arm Cortex-R82AE (cortex-r82ae).
912+
* Arm Cortex-R52+ (cortex-r52plus).
912913
* Arm Neoverse-N3 (neoverse-n3).
913914
* Arm Neoverse-V3 (neoverse-v3).
914915
* Arm Neoverse-V3AE (neoverse-v3ae).

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ CODEGENOPT(SeparateNamedSections, 1, 0) ///< Set for -fseparate-named-sections.
6363
CODEGENOPT(EnableAIXExtendedAltivecABI, 1, 0) ///< Set for -mabi=vec-extabi. Enables the extended Altivec ABI on AIX.
6464
CODEGENOPT(XCOFFReadOnlyPointers, 1, 0) ///< Set for -mxcoff-roptr.
6565
CODEGENOPT(AllTocData, 1, 0) ///< AIX -mtocdata
66-
ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None) /// frame-pointer: all,non-leaf,none
66+
ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None) /// frame-pointer: all,non-leaf,reserved,none
6767

6868
CODEGENOPT(ClearASTBeforeBackend , 1, 0) ///< Free the AST before running backend code generation. Only works with -disable-free.
6969
CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory.

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,18 @@ class CodeGenOptions : public CodeGenOptionsBase {
127127
std::string BinutilsVersion;
128128

129129
enum class FramePointerKind {
130-
None, // Omit all frame pointers.
131-
NonLeaf, // Keep non-leaf frame pointers.
132-
All, // Keep all frame pointers.
130+
None, // Omit all frame pointers.
131+
Reserved, // Maintain valid frame pointer chain.
132+
NonLeaf, // Keep non-leaf frame pointers.
133+
All, // Keep all frame pointers.
133134
};
134135

135136
static StringRef getFramePointerKindName(FramePointerKind Kind) {
136137
switch (Kind) {
137138
case FramePointerKind::None:
138139
return "none";
140+
case FramePointerKind::Reserved:
141+
return "reserved";
139142
case FramePointerKind::NonLeaf:
140143
return "non-leaf";
141144
case FramePointerKind::All:

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7837,8 +7837,8 @@ def pic_is_pie : Flag<["-"], "pic-is-pie">,
78377837
MarshallingInfoFlag<LangOpts<"PIE">>;
78387838

78397839
def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
7840-
HelpText<"Specify which frame pointers to retain.">, Values<"all,non-leaf,none">,
7841-
NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "None"]>,
7840+
HelpText<"Specify which frame pointers to retain.">, Values<"all,non-leaf,reserved,none">,
7841+
NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "Reserved", "None"]>,
78427842
MarshallingInfoEnum<CodeGenOpts<"FramePointer">, "None">;
78437843

78447844

clang/include/clang/Sema/Initialization.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class alignas(8) InitializedEntity {
212212
struct C Capture;
213213
};
214214

215-
InitializedEntity() {};
215+
InitializedEntity() {}
216216

217217
/// Create the initialization entity for a variable.
218218
InitializedEntity(VarDecl *Var, EntityKind EK = EK_Variable)

clang/include/clang/Tooling/Syntax/Tokens.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ class TokenBuffer {
292292
/// "DECL", "(", "a", ")", ";"}
293293
llvm::ArrayRef<syntax::Token> spelledTokens(FileID FID) const;
294294

295-
/// Returns the spelled Token starting at Loc, if there are no such tokens
295+
/// Returns the spelled Token containing the Loc, if there are no such tokens
296296
/// returns nullptr.
297-
const syntax::Token *spelledTokenAt(SourceLocation Loc) const;
297+
const syntax::Token *spelledTokenContaining(SourceLocation Loc) const;
298298

299299
/// Get all tokens that expand a macro in \p FID. For the following input
300300
/// #define FOO B

0 commit comments

Comments
 (0)