Skip to content

Commit a7f5b4f

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:ba976971898d74df38d155c55e008c898120d1e4 into amd-gfx:77eaf56bc521
Local branch amd-gfx 77eaf56 Merged main:4fe33d067c5d0894d0059418f09edc531f16ac9f into amd-gfx:5fa38fbc60f8 Remote branch main ba97697 [NVPTX] support switch statement with brx.idx (llvm#102400)
2 parents 77eaf56 + ba97697 commit a7f5b4f

File tree

520 files changed

+15766
-10413
lines changed

Some content is hidden

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

520 files changed

+15766
-10413
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
/clang/www/cxx_dr_status.html @Endilll
3434
/clang/www/make_cxx_dr_status @Endilll
3535

36-
clang/lib/AST/Interp/ @tbaederr
37-
clang/test/AST/Interp/ @tbaederr
38-
3936
/clang/include/clang/CIR @lanza @bcardosolopes
4037
/clang/lib/CIR @lanza @bcardosolopes
4138
/clang/tools/cir-* @lanza @bcardosolopes

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ on:
2222
- '.github/workflows/libclang-python-tests.yml'
2323
- '.github/workflows/llvm-project-tests.yml'
2424

25-
concurrency:
26-
# Skip intermediate builds: always.
27-
# Cancel intermediate builds: only if it is a pull request build.
28-
group: ${{ github.workflow }}-${{ github.ref }}
29-
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
30-
3125
jobs:
3226
check-clang-python:
3327
# Build libclang and then run the libclang Python binding's unit tests.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ concurrency:
5151
# Cancel intermediate builds: only if it is a pull request build.
5252
# If the group name here is the same as the group name in the workflow that includes
5353
# this one, then the action will try to wait on itself and get stuck.
54-
group: llvm-project-${{ github.workflow }}-${{ inputs.projects }}${{ github.ref }}
54+
group: llvm-project-${{ github.workflow }}-${{ inputs.projects }}-${{ inputs.python_version }}${{ github.ref }}
5555
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
5656

5757
jobs:

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,7 @@ class BinaryContext {
911911
/// of \p Flags.
912912
MCSymbol *registerNameAtAddress(StringRef Name, uint64_t Address,
913913
uint64_t Size, uint16_t Alignment,
914-
unsigned Flags = 0,
915-
BinarySection *Section = NULL);
914+
unsigned Flags = 0);
916915

917916
/// Return BinaryData registered at a given \p Address or nullptr if no
918917
/// global symbol was registered at the location.

bolt/lib/Core/BinaryContext.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,28 +1055,18 @@ void BinaryContext::adjustCodePadding() {
10551055
MCSymbol *BinaryContext::registerNameAtAddress(StringRef Name, uint64_t Address,
10561056
uint64_t Size,
10571057
uint16_t Alignment,
1058-
unsigned Flags,
1059-
BinarySection *Section) {
1058+
unsigned Flags) {
10601059
// Register the name with MCContext.
10611060
MCSymbol *Symbol = Ctx->getOrCreateSymbol(Name);
1062-
BinaryData *BD;
1063-
1064-
// Register out of section symbols only in GlobalSymbols map
1065-
if (Section && Section->getEndAddress() == Address) {
1066-
BD = new BinaryData(*Symbol, Address, Size, Alignment ? Alignment : 1,
1067-
*Section, Flags);
1068-
GlobalSymbols[Name] = BD;
1069-
return Symbol;
1070-
}
10711061

10721062
auto GAI = BinaryDataMap.find(Address);
1063+
BinaryData *BD;
10731064
if (GAI == BinaryDataMap.end()) {
10741065
ErrorOr<BinarySection &> SectionOrErr = getSectionForAddress(Address);
1075-
BinarySection &SectionRef = Section ? *Section
1076-
: SectionOrErr ? SectionOrErr.get()
1077-
: absoluteSection();
1066+
BinarySection &Section =
1067+
SectionOrErr ? SectionOrErr.get() : absoluteSection();
10781068
BD = new BinaryData(*Symbol, Address, Size, Alignment ? Alignment : 1,
1079-
SectionRef, Flags);
1069+
Section, Flags);
10801070
GAI = BinaryDataMap.emplace(Address, BD).first;
10811071
GlobalSymbols[Name] = BD;
10821072
updateObjectNesting(GAI);
@@ -1411,7 +1401,7 @@ void BinaryContext::postProcessSymbolTable() {
14111401
if ((BD->getName().starts_with("SYMBOLat") ||
14121402
BD->getName().starts_with("DATAat")) &&
14131403
!BD->getParent() && !BD->getSize() && !BD->isAbsolute() &&
1414-
BD->getSection().getSize()) {
1404+
BD->getSection()) {
14151405
this->errs() << "BOLT-WARNING: zero-sized top level symbol: " << *BD
14161406
<< "\n";
14171407
Valid = false;

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -956,13 +956,13 @@ void RewriteInstance::discoverFileObjects() {
956956
uint64_t SymbolSize = ELFSymbolRef(Symbol).getSize();
957957
uint64_t SymbolAlignment = Symbol.getAlignment();
958958

959-
auto registerName = [&](uint64_t FinalSize, BinarySection *Section = NULL) {
959+
auto registerName = [&](uint64_t FinalSize) {
960960
// Register names even if it's not a function, e.g. for an entry point.
961961
BC->registerNameAtAddress(UniqueName, SymbolAddress, FinalSize,
962-
SymbolAlignment, SymbolFlags, Section);
962+
SymbolAlignment, SymbolFlags);
963963
if (!AlternativeName.empty())
964964
BC->registerNameAtAddress(AlternativeName, SymbolAddress, FinalSize,
965-
SymbolAlignment, SymbolFlags, Section);
965+
SymbolAlignment, SymbolFlags);
966966
};
967967

968968
section_iterator Section =
@@ -987,25 +987,12 @@ void RewriteInstance::discoverFileObjects() {
987987
<< " for function\n");
988988

989989
if (SymbolAddress == Section->getAddress() + Section->getSize()) {
990-
ErrorOr<BinarySection &> SectionOrError =
991-
BC->getSectionForAddress(Section->getAddress());
992-
993-
// Skip symbols from invalid sections
994-
if (!SectionOrError) {
995-
BC->errs() << "BOLT-WARNING: " << UniqueName << " (0x"
996-
<< Twine::utohexstr(SymbolAddress)
997-
<< ") does not have any section\n";
998-
continue;
999-
}
1000-
1001990
assert(SymbolSize == 0 &&
1002991
"unexpect non-zero sized symbol at end of section");
1003-
LLVM_DEBUG({
1004-
dbgs() << "BOLT-DEBUG: rejecting as symbol " << UniqueName
1005-
<< " points to end of " << SectionOrError->getName()
1006-
<< " section\n";
1007-
});
1008-
registerName(SymbolSize, &SectionOrError.get());
992+
LLVM_DEBUG(
993+
dbgs()
994+
<< "BOLT-DEBUG: rejecting as symbol points to end of its section\n");
995+
registerName(SymbolSize);
1009996
continue;
1010997
}
1011998

@@ -2637,30 +2624,6 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
26372624
}
26382625
}
26392626

2640-
if (Relocation::isGOT(RType) && !Relocation::isTLS(RType)) {
2641-
auto exitOnGotEndSymol = [&](StringRef Name) {
2642-
BC->errs() << "BOLT-ERROR: GOT table contains currently unsupported "
2643-
"section end symbol "
2644-
<< Name << "\n";
2645-
exit(1);
2646-
};
2647-
2648-
if (SymbolIter != InputFile->symbol_end() && ReferencedSection) {
2649-
if (cantFail(SymbolIter->getAddress()) ==
2650-
ReferencedSection->getEndAddress())
2651-
exitOnGotEndSymol(cantFail(SymbolIter->getName()));
2652-
} else {
2653-
// If no section and symbol are provided by relocation, try to find the
2654-
// symbol by its name, including the possibility that the symbol is local.
2655-
BinaryData *BD = BC->getBinaryDataByName(SymbolName);
2656-
if (!BD && NR.getUniquifiedNameCount(SymbolName) == 1)
2657-
BD = BC->getBinaryDataByName(NR.getUniqueName(SymbolName, 1));
2658-
2659-
if ((BD && BD->getAddress() == BD->getSection().getEndAddress()))
2660-
exitOnGotEndSymol(BD->getName());
2661-
}
2662-
}
2663-
26642627
if (!ReferencedSection)
26652628
ReferencedSection = BC->getSectionForAddress(SymbolAddress);
26662629

bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script

Lines changed: 0 additions & 6 deletions
This file was deleted.

bolt/test/AArch64/got_end_of_section_symbol.s

Lines changed: 0 additions & 28 deletions
This file was deleted.

bolt/test/X86/section-end-sym.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## Check that BOLT doesn't consider end-of-section symbols (e.g., _etext) as
22
## functions.
33

4-
# REQUIRES: system-linux, asserts
4+
# REQUIRES: x86_64-linux, asserts
55

66
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
77
# RUN: ld.lld %t.o -o %t.exe -q
88
# RUN: llvm-bolt %t.exe -o %t.null --print-cfg --debug-only=bolt 2>&1 \
99
# RUN: | FileCheck %s
1010

1111
# CHECK: considering symbol etext for function
12-
# CHECK-NEXT: rejecting as symbol etext points to end of .text section
12+
# CHECK-NEXT: rejecting as symbol points to end of its section
1313
# CHECK-NOT: Binary Function "etext{{.*}}" after building cfg
1414

1515

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,5 +384,12 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
384384
}
385385
}
386386

387+
void ScopeChildren::sort() {
388+
llvm::sort(Namespaces.begin(), Namespaces.end());
389+
llvm::sort(Records.begin(), Records.end());
390+
llvm::sort(Functions.begin(), Functions.end());
391+
llvm::sort(Enums.begin(), Enums.end());
392+
llvm::sort(Typedefs.begin(), Typedefs.end());
393+
}
387394
} // namespace doc
388395
} // namespace clang

clang-tools-extra/clang-doc/Representation.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct Reference {
104104

105105
bool mergeable(const Reference &Other);
106106
void merge(Reference &&I);
107+
bool operator<(const Reference &Other) const { return Name < Other.Name; }
107108

108109
/// Returns the path for this Reference relative to CurrentPath.
109110
llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
@@ -145,6 +146,8 @@ struct ScopeChildren {
145146
std::vector<FunctionInfo> Functions;
146147
std::vector<EnumInfo> Enums;
147148
std::vector<TypedefInfo> Typedefs;
149+
150+
void sort();
148151
};
149152

150153
// A base struct for TypeInfos
@@ -245,6 +248,11 @@ struct Location {
245248
std::tie(Other.LineNumber, Other.Filename);
246249
}
247250

251+
bool operator!=(const Location &Other) const {
252+
return std::tie(LineNumber, Filename) !=
253+
std::tie(Other.LineNumber, Other.Filename);
254+
}
255+
248256
// This operator is used to sort a vector of Locations.
249257
// No specific order (attributes more important than others) is required. Any
250258
// sort is enough, the order is only needed to call std::unique after sorting
@@ -270,10 +278,12 @@ struct Info {
270278

271279
virtual ~Info() = default;
272280

281+
Info &operator=(Info &&Other) = default;
282+
273283
SymbolID USR =
274284
SymbolID(); // Unique identifier for the decl described by this Info.
275-
const InfoType IT = InfoType::IT_default; // InfoType of this particular Info.
276-
SmallString<16> Name; // Unqualified name of the decl.
285+
InfoType IT = InfoType::IT_default; // InfoType of this particular Info.
286+
SmallString<16> Name; // Unqualified name of the decl.
277287
llvm::SmallVector<Reference, 4>
278288
Namespace; // List of parent namespaces for this decl.
279289
std::vector<CommentInfo> Description; // Comment description of this decl.
@@ -312,6 +322,20 @@ struct SymbolInfo : public Info {
312322

313323
std::optional<Location> DefLoc; // Location where this decl is defined.
314324
llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
325+
326+
bool operator<(const SymbolInfo &Other) const {
327+
// Sort by declaration location since we want the doc to be
328+
// generated in the order of the source code.
329+
// If the declaration location is the same, or not present
330+
// we sort by defined location otherwise fallback to the extracted name
331+
if (Loc.size() > 0 && Other.Loc.size() > 0 && Loc[0] != Other.Loc[0])
332+
return Loc[0] < Other.Loc[0];
333+
334+
if (DefLoc && Other.DefLoc && *DefLoc != *Other.DefLoc)
335+
return *DefLoc < *Other.DefLoc;
336+
337+
return extractName() < Other.extractName();
338+
}
315339
};
316340

317341
// TODO: Expand to allow for documenting templating and default args.

clang-tools-extra/clang-doc/tool/ClangDocMain.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,22 @@ llvm::Error getHtmlAssetFiles(const char *Argv0,
205205
return getDefaultAssetFiles(Argv0, CDCtx);
206206
}
207207

208+
/// Make the output of clang-doc deterministic by sorting the children of
209+
/// namespaces and records.
210+
void sortUsrToInfo(llvm::StringMap<std::unique_ptr<doc::Info>> &USRToInfo) {
211+
for (auto &I : USRToInfo) {
212+
auto &Info = I.second;
213+
if (Info->IT == doc::InfoType::IT_namespace) {
214+
auto *Namespace = static_cast<clang::doc::NamespaceInfo *>(Info.get());
215+
Namespace->Children.sort();
216+
}
217+
if (Info->IT == doc::InfoType::IT_record) {
218+
auto *Record = static_cast<clang::doc::RecordInfo *>(Info.get());
219+
Record->Children.sort();
220+
}
221+
}
222+
}
223+
208224
int main(int argc, const char **argv) {
209225
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
210226
std::error_code OK;
@@ -341,6 +357,8 @@ Example usage for a project using a compile commands database:
341357
if (Error)
342358
return 1;
343359

360+
sortUsrToInfo(USRToInfo);
361+
344362
// Ensure the root output directory exists.
345363
if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory);
346364
Err != std::error_code()) {

clang-tools-extra/clang-tidy/tool/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ clang_target_link_libraries(clangTidyMain
3333
# Support plugins.
3434
if(CLANG_PLUGIN_SUPPORT)
3535
set(support_plugins SUPPORT_PLUGINS)
36-
set(export_symbols EXPORT_SYMBOLS_FOR_PLUGINS)
3736
endif()
3837

3938
add_clang_tool(clang-tidy
@@ -42,7 +41,6 @@ add_clang_tool(clang-tidy
4241
DEPENDS
4342
clang-resource-headers
4443
${support_plugins}
45-
${export_symbols}
4644
)
4745
clang_target_link_libraries(clang-tidy
4846
PRIVATE
@@ -59,6 +57,10 @@ target_link_libraries(clang-tidy
5957
${ALL_CLANG_TIDY_CHECKS}
6058
)
6159

60+
if(CLANG_PLUGIN_SUPPORT)
61+
export_executable_symbols_for_plugins(clang-tidy)
62+
endif()
63+
6264
install(PROGRAMS clang-tidy-diff.py
6365
DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
6466
COMPONENT clang-tidy)

clang-tools-extra/test/clang-doc/basic-project.test

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// See https://github.com/llvm/llvm-project/issues/97507.
2-
// UNSUPPORTED: target={{.*}}
3-
41
// RUN: rm -rf %t && mkdir -p %t/docs %t/build
52
// RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json
63
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
@@ -61,13 +58,13 @@
6158
// HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p>
6259
// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
6360
// HTML-SHAPE: <h2 id="Functions">Functions</h2>
64-
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
65-
// HTML-SHAPE: <p>public void ~Shape()</p>
66-
// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
6761
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
6862
// HTML-SHAPE: <p>public double area()</p>
6963
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
7064
// HTML-SHAPE: <p>public double perimeter()</p>
65+
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
66+
// HTML-SHAPE: <p>public void ~Shape()</p>
67+
// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
7168

7269
// HTML-CALC: <h1>class Calculator</h1>
7370
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>

clang-tools-extra/test/clang-doc/namespace.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,16 @@ namespace AnotherNamespace {
272272
// HTML-GLOBAL-INDEX: <h1>Global Namespace</h1>
273273
// HTML-GLOBAL-INDEX: <h2 id="Namespaces">Namespaces</h2>
274274
// HTML-GLOBAL-INDEX: <li>@nonymous_namespace</li>
275-
// HTML-GLOBAL-INDEX: <li>PrimaryNamespace</li>
276275
// HTML-GLOBAL-INDEX: <li>AnotherNamespace</li>
276+
// HTML-GLOBAL-INDEX: <li>PrimaryNamespace</li>
277+
277278

278279
// MD-GLOBAL-INDEX: # Global Namespace
279280
// MD-GLOBAL-INDEX: ## Namespaces
280281
// MD-GLOBAL-INDEX: * [@nonymous_namespace](..{{[\/]}}@nonymous_namespace{{[\/]}}index.md)
281-
// MD-GLOBAL-INDEX: * [PrimaryNamespace](..{{[\/]}}PrimaryNamespace{{[\/]}}index.md)
282282
// MD-GLOBAL-INDEX: * [AnotherNamespace](..{{[\/]}}AnotherNamespace{{[\/]}}index.md)
283+
// MD-GLOBAL-INDEX: * [PrimaryNamespace](..{{[\/]}}PrimaryNamespace{{[\/]}}index.md)
284+
283285

284286
// MD-ALL-FILES: # All Files
285287
// MD-ALL-FILES: ## [@nonymous_namespace](@nonymous_namespace{{[\/]}}index.md)

0 commit comments

Comments
 (0)