Skip to content

Commit 97d068c

Browse files
authored
Merge branch 'main' into bugprone-method-hiding
2 parents d337e82 + 9d65f77 commit 97d068c

File tree

487 files changed

+14401
-7107
lines changed

Some content is hidden

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

487 files changed

+14401
-7107
lines changed

.ci/compute_projects.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
333333
current_platform = platform.system()
334334
if len(sys.argv) == 2:
335335
current_platform = sys.argv[1]
336-
env_variables = get_env_variables(sys.stdin.readlines(), current_platform)
336+
changed_files = [line.strip() for line in sys.stdin.readlines()]
337+
env_variables = get_env_variables(changed_files, current_platform)
337338
for env_variable in env_variables:
338339
print(f"{env_variable}='{env_variables[env_variable]}'")

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ RUN apt-get update && \
7373
# caching), so we manually install it here.
7474
# TODO(boomanaiden154): We should return to installing this from the apt
7575
# repository once a version containing the necessary bug fixes is available.
76-
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
77-
echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b /tmp/sccache.tar.gz" | sha256sum -c && \
76+
RUN curl -L "https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-$(arch)-unknown-linux-musl.tar.gz" > /tmp/sccache.tar.gz && \
77+
echo $( [ $(arch) = 'x86_64' ] && echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b" || echo "d6a1ce4acd02b937cd61bc675a8be029a60f7bc167594c33d75732bbc0a07400") /tmp/sccache.tar.gz | sha256sum -c && \
7878
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
7979
rm /tmp/sccache.tar.gz && \
8080
chmod +x /usr/local/bin/sccache

.github/workflows/premerge.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
# several test suites in a row and discard statistics that we want
6666
# to save in the end.
6767
export SCCACHE_IDLE_TIMEOUT=0
68-
sccache --start-server
68+
mkdir artifacts
69+
SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server
6970
7071
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
7172
- name: Upload Artifacts
@@ -117,7 +118,7 @@ jobs:
117118
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
118119
# See the comments above in the Linux job for why we define each of
119120
# these environment variables.
120-
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
121+
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; mkdir artifacts; SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
121122
- name: Upload Artifacts
122123
# In some cases, Github will fail to upload the artifact. We want to
123124
# continue anyways as a failed artifact upload is an infra failure, not

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,6 +3773,8 @@ MCSymbol *BinaryFunction::addEntryPointAtOffset(uint64_t Offset) {
37733773
assert(Offset && "cannot add primary entry point");
37743774

37753775
const uint64_t EntryPointAddress = getAddress() + Offset;
3776+
assert(!isInConstantIsland(EntryPointAddress) &&
3777+
"cannot add entry point that points to constant data");
37763778
MCSymbol *LocalSymbol = getOrCreateLocalLabel(EntryPointAddress);
37773779

37783780
MCSymbol *EntrySymbol = getSecondaryEntryPointSymbol(LocalSymbol);

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2935,7 +2935,8 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
29352935
ReferencedSymbol = nullptr;
29362936
ExtractedValue = Address;
29372937
} else if (RefFunctionOffset) {
2938-
if (ContainingBF && ContainingBF != ReferencedBF) {
2938+
if (ContainingBF && ContainingBF != ReferencedBF &&
2939+
!ReferencedBF->isInConstantIsland(Address)) {
29392940
ReferencedSymbol =
29402941
ReferencedBF->addEntryPointAtOffset(RefFunctionOffset);
29412942
} else {

bolt/test/AArch64/validate-secondary-entry-point.s

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# This test is to verify that BOLT won't take a label pointing to constant
2-
# island as a secondary entry point (function `_start` doesn't have ELF size
3-
# set originally) and the function won't otherwise be mistaken as non-simple.
2+
# island as a secondary entry point. This could happen when function doesn't
3+
# have ELF size set if it is from assembly code, or a constant island is
4+
# referenced by another function discovered during relocation processing.
45

5-
# RUN: %clang %cflags -pie %s -o %t.so -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
6+
# RUN: split-file %s %t
7+
8+
# RUN: %clang %cflags -pie %t/tt.asm -o %t.so \
9+
# RUN: -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
610
# RUN: llvm-bolt %t.so -o %t.bolt.so --print-cfg 2>&1 | FileCheck %s
711
# CHECK-NOT: BOLT-WARNING: reference in the middle of instruction detected \
812
# CHECK-NOT: function _start at offset 0x{{[0-9a-f]+}}
913
# CHECK: Binary Function "_start" after building cfg
1014

15+
# RUN: %clang %cflags -ffunction-sections -shared %t/tt.c %t/ss.c -o %tt.so \
16+
# RUN: -Wl,-q -Wl,--init=_start -Wl,--fini=_start \
17+
# RUN: -Wl,--version-script=%t/linker_script
18+
# RUN: llvm-bolt %tt.so -o %tt.bolted.so
19+
20+
;--- tt.asm
1121
.text
1222

1323
.global _foo
@@ -32,3 +42,31 @@ _bar:
3242

3343
# Dummy relocation to force relocation mode
3444
.reloc 0, R_AARCH64_NONE
45+
46+
;--- tt.c
47+
void _start() {}
48+
49+
__attribute__((naked)) void foo() {
50+
asm("ldr x16, .L_fnptr\n"
51+
"blr x16\n"
52+
"ret\n"
53+
54+
"_rodatx:"
55+
".global _rodatx;"
56+
".quad 0;"
57+
".L_fnptr:"
58+
".quad 0;");
59+
}
60+
61+
;--- ss.c
62+
__attribute__((visibility("hidden"))) extern void* _rodatx;
63+
void* bar() { return &_rodatx; }
64+
65+
;--- linker_script
66+
{
67+
global:
68+
_start;
69+
foo;
70+
bar;
71+
local: *;
72+
};

clang-tools-extra/clang-tidy/bugprone/TaggedUnionMemberCountCheck.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,8 @@ void TaggedUnionMemberCountCheck::check(
169169
if (!Root || !UnionField || !TagField)
170170
return;
171171

172-
const auto *UnionDef =
173-
UnionField->getType().getCanonicalType().getTypePtr()->getAsRecordDecl();
174-
const auto *EnumDef = llvm::dyn_cast<EnumDecl>(
175-
TagField->getType().getCanonicalType().getTypePtr()->getAsTagDecl());
176-
177-
assert(UnionDef && "UnionDef is missing!");
178-
assert(EnumDef && "EnumDef is missing!");
179-
if (!UnionDef || !EnumDef)
180-
return;
172+
const auto *UnionDef = UnionField->getType()->castAsRecordDecl();
173+
const auto *EnumDef = TagField->getType()->castAsEnumDecl();
181174

182175
const std::size_t UnionMemberCount = llvm::range_size(UnionDef->fields());
183176
auto [TagCount, CountingEnumConstantDecl] = getNumberOfEnumValues(EnumDef);

clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ ExceptionSpecAnalyzer::analyzeBase(const CXXBaseSpecifier &Base,
6666
if (!RecType)
6767
return State::Unknown;
6868

69-
const auto *BaseClass =
70-
cast<CXXRecordDecl>(RecType->getOriginalDecl())->getDefinitionOrSelf();
71-
72-
return analyzeRecord(BaseClass, Kind);
69+
return analyzeRecord(RecType->getAsCXXRecordDecl(), Kind);
7370
}
7471

7572
ExceptionSpecAnalyzer::State

clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,9 @@ bool FormatStringConverter::emitIntegerArgument(
460460
// be passed as its underlying type. However, printf will have forced
461461
// the signedness based on the format string, so we need to do the
462462
// same.
463-
if (const auto *ET = ArgType->getAs<EnumType>()) {
464-
if (const std::optional<std::string> MaybeCastType = castTypeForArgument(
465-
ArgKind,
466-
ET->getOriginalDecl()->getDefinitionOrSelf()->getIntegerType()))
463+
if (const auto *ED = ArgType->getAsEnumDecl()) {
464+
if (const std::optional<std::string> MaybeCastType =
465+
castTypeForArgument(ArgKind, ED->getIntegerType()))
467466
ArgFixes.emplace_back(
468467
ArgIndex, (Twine("static_cast<") + *MaybeCastType + ">(").str());
469468
else

clang-tools-extra/clangd/Hover.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@ std::optional<std::string> printExprValue(const Expr *E,
454454
Constant.Val.getInt().getSignificantBits() <= 64) {
455455
// Compare to int64_t to avoid bit-width match requirements.
456456
int64_t Val = Constant.Val.getInt().getExtValue();
457-
for (const EnumConstantDecl *ECD :
458-
T->castAs<EnumType>()->getOriginalDecl()->enumerators())
457+
for (const EnumConstantDecl *ECD : T->castAsEnumDecl()->enumerators())
459458
if (ECD->getInitVal() == Val)
460459
return llvm::formatv("{0} ({1})", ECD->getNameAsString(),
461460
printHex(Constant.Val.getInt()))
@@ -832,7 +831,7 @@ std::optional<HoverInfo> getThisExprHoverContents(const CXXThisExpr *CTE,
832831
ASTContext &ASTCtx,
833832
const PrintingPolicy &PP) {
834833
QualType OriginThisType = CTE->getType()->getPointeeType();
835-
QualType ClassType = declaredType(OriginThisType->getAsTagDecl());
834+
QualType ClassType = declaredType(OriginThisType->castAsTagDecl());
836835
// For partial specialization class, origin `this` pointee type will be
837836
// parsed as `InjectedClassNameType`, which will ouput template arguments
838837
// like "type-parameter-0-0". So we retrieve user written class type in this

0 commit comments

Comments
 (0)