Skip to content

Commit 19a0ab5

Browse files
committed
Address comments
Created using spr 1.3.5
2 parents 7420027 + ed8ebad commit 19a0ab5

File tree

1,428 files changed

+28612
-21360
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,428 files changed

+28612
-21360
lines changed

.ci/generate_test_report.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,8 @@ def test_report_size_limit(self):
309309
# If include failures is False, total number of test will be reported but their names
310310
# and output will not be.
311311
def _generate_report(title, junit_objects, size_limit=1024 * 1024, list_failures=True):
312-
style = None
313-
314312
if not junit_objects:
315-
return ("", style)
313+
return ("", "success")
316314

317315
failures = {}
318316
tests_run = 0
@@ -403,22 +401,23 @@ def generate_report(title, junit_files):
403401

404402
report, style = generate_report(args.title, args.junit_files)
405403

406-
p = subprocess.Popen(
407-
[
408-
"buildkite-agent",
409-
"annotate",
410-
"--context",
411-
args.context,
412-
"--style",
413-
style,
414-
],
415-
stdin=subprocess.PIPE,
416-
stderr=subprocess.PIPE,
417-
universal_newlines=True,
418-
)
404+
if report:
405+
p = subprocess.Popen(
406+
[
407+
"buildkite-agent",
408+
"annotate",
409+
"--context",
410+
args.context,
411+
"--style",
412+
style,
413+
],
414+
stdin=subprocess.PIPE,
415+
stderr=subprocess.PIPE,
416+
universal_newlines=True,
417+
)
419418

420-
# The report can be larger than the buffer for command arguments so we send
421-
# it over stdin instead.
422-
_, err = p.communicate(input=report)
423-
if p.returncode:
424-
raise RuntimeError(f"Failed to send report to buildkite-agent:\n{err}")
419+
# The report can be larger than the buffer for command arguments so we send
420+
# it over stdin instead.
421+
_, err = p.communicate(input=report)
422+
if p.returncode:
423+
raise RuntimeError(f"Failed to send report to buildkite-agent:\n{err}")

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ env:
4545
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
4646
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
4747

48-
4948
jobs:
5049
stage1:
5150
if: github.repository_owner == 'llvm'
52-
runs-on: libcxx-runners-set
53-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
51+
runs-on: libcxx-self-hosted-linux
52+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
5453
continue-on-error: false
5554
strategy:
5655
fail-fast: false
@@ -86,8 +85,8 @@ jobs:
8685
**/crash_diagnostics/*
8786
stage2:
8887
if: github.repository_owner == 'llvm'
89-
runs-on: libcxx-runners-set
90-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
88+
runs-on: libcxx-self-hosted-linux
89+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
9190
needs: [ stage1 ]
9291
continue-on-error: false
9392
strategy:
@@ -161,21 +160,21 @@ jobs:
161160
'generic-static',
162161
'bootstrapping-build'
163162
]
164-
machine: [ 'libcxx-runners-set' ]
163+
machine: [ 'libcxx-self-hosted-linux' ]
165164
include:
166165
- config: 'generic-cxx26'
167-
machine: libcxx-runners-set
166+
machine: libcxx-self-hosted-linux
168167
- config: 'generic-asan'
169-
machine: libcxx-runners-set
168+
machine: libcxx-self-hosted-linux
170169
- config: 'generic-tsan'
171-
machine: libcxx-runners-set
170+
machine: libcxx-self-hosted-linux
172171
- config: 'generic-ubsan'
173-
machine: libcxx-runners-set
172+
machine: libcxx-self-hosted-linux
174173
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
175174
- config: 'generic-msan'
176-
machine: libcxx-runners-set
175+
machine: libcxx-self-hosted-linux
177176
runs-on: ${{ matrix.machine }}
178-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
177+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
179178
steps:
180179
- uses: actions/checkout@v4
181180
- name: ${{ matrix.config }}

.github/workflows/libcxx-build-containers.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,23 @@ jobs:
2929
build-and-push:
3030
runs-on: ubuntu-latest
3131
if: github.repository_owner == 'llvm'
32+
permissions:
33+
packages: write
3234

3335
steps:
3436
- uses: actions/checkout@v4
3537

3638
- name: Build the Linux builder image
3739
working-directory: libcxx/utils/ci
3840
run: docker compose build actions-builder
41+
env:
42+
TAG: ${{ github.sha }}
3943

4044
# - name: Build the Android builder image
4145
# working-directory: libcxx/utils/ci
4246
# run: docker compose build android-buildkite-builder
47+
# env:
48+
# TAG: ${{ github.sha }}
4349

4450
- name: Log in to GitHub Container Registry
4551
uses: docker/login-action@v3

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -906,17 +906,6 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
906906
if (Sites.empty())
907907
return;
908908

909-
// Calculate callsite table size. Size of each callsite entry is:
910-
//
911-
// sizeof(start) + sizeof(length) + sizeof(LP) + sizeof(uleb128(action))
912-
//
913-
// or
914-
//
915-
// sizeof(dwarf::DW_EH_PE_data4) * 3 + sizeof(uleb128(action))
916-
uint64_t CallSiteTableLength = llvm::size(Sites) * 4 * 3;
917-
for (const auto &FragmentCallSite : Sites)
918-
CallSiteTableLength += getULEB128Size(FragmentCallSite.second.Action);
919-
920909
Streamer.switchSection(BC.MOFI->getLSDASection());
921910

922911
const unsigned TTypeEncoding = BF.getLSDATypeEncoding();
@@ -975,36 +964,24 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
975964

976965
Streamer.emitIntValue(TTypeEncoding, 1); // TType format
977966

978-
// See the comment in EHStreamer::emitExceptionTable() on to use
979-
// uleb128 encoding (which can use variable number of bytes to encode the same
980-
// value) to ensure type info table is properly aligned at 4 bytes without
981-
// iteratively fixing sizes of the tables.
982-
unsigned CallSiteTableLengthSize = getULEB128Size(CallSiteTableLength);
983-
unsigned TTypeBaseOffset =
984-
sizeof(int8_t) + // Call site format
985-
CallSiteTableLengthSize + // Call site table length size
986-
CallSiteTableLength + // Call site table length
987-
BF.getLSDAActionTable().size() + // Actions table size
988-
BF.getLSDATypeTable().size() * TTypeEncodingSize; // Types table size
989-
unsigned TTypeBaseOffsetSize = getULEB128Size(TTypeBaseOffset);
990-
unsigned TotalSize = sizeof(int8_t) + // LPStart format
991-
sizeof(int8_t) + // TType format
992-
TTypeBaseOffsetSize + // TType base offset size
993-
TTypeBaseOffset; // TType base offset
994-
unsigned SizeAlign = (4 - TotalSize) & 3;
995-
996-
if (TTypeEncoding != dwarf::DW_EH_PE_omit)
997-
// Account for any extra padding that will be added to the call site table
998-
// length.
999-
Streamer.emitULEB128IntValue(TTypeBaseOffset,
1000-
/*PadTo=*/TTypeBaseOffsetSize + SizeAlign);
967+
MCSymbol *TTBaseLabel = nullptr;
968+
if (TTypeEncoding != dwarf::DW_EH_PE_omit) {
969+
TTBaseLabel = BC.Ctx->createTempSymbol("TTBase");
970+
MCSymbol *TTBaseRefLabel = BC.Ctx->createTempSymbol("TTBaseRef");
971+
Streamer.emitAbsoluteSymbolDiffAsULEB128(TTBaseLabel, TTBaseRefLabel);
972+
Streamer.emitLabel(TTBaseRefLabel);
973+
}
1001974

1002975
// Emit the landing pad call site table. We use signed data4 since we can emit
1003976
// a landing pad in a different part of the split function that could appear
1004977
// earlier in the address space than LPStart.
1005978
Streamer.emitIntValue(dwarf::DW_EH_PE_sdata4, 1);
1006-
Streamer.emitULEB128IntValue(CallSiteTableLength);
1007979

980+
MCSymbol *CSTStartLabel = BC.Ctx->createTempSymbol("CSTStart");
981+
MCSymbol *CSTEndLabel = BC.Ctx->createTempSymbol("CSTEnd");
982+
Streamer.emitAbsoluteSymbolDiffAsULEB128(CSTEndLabel, CSTStartLabel);
983+
984+
Streamer.emitLabel(CSTStartLabel);
1008985
for (const auto &FragmentCallSite : Sites) {
1009986
const BinaryFunction::CallSite &CallSite = FragmentCallSite.second;
1010987
const MCSymbol *BeginLabel = CallSite.Start;
@@ -1020,6 +997,7 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
1020997
emitLandingPad(CallSite.LP);
1021998
Streamer.emitULEB128IntValue(CallSite.Action);
1022999
}
1000+
Streamer.emitLabel(CSTEndLabel);
10231001

10241002
// Write out action, type, and type index tables at the end.
10251003
//
@@ -1038,6 +1016,8 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
10381016
assert(TypeTable.size() == BF.getLSDATypeTable().size() &&
10391017
"indirect type table size mismatch");
10401018

1019+
Streamer.emitValueToAlignment(Align(TTypeAlignment));
1020+
10411021
for (int Index = TypeTable.size() - 1; Index >= 0; --Index) {
10421022
const uint64_t TypeAddress = TypeTable[Index];
10431023
switch (TTypeEncoding & 0x70) {
@@ -1063,6 +1043,10 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
10631043
}
10641044
}
10651045
}
1046+
1047+
if (TTypeEncoding != dwarf::DW_EH_PE_omit)
1048+
Streamer.emitLabel(TTBaseLabel);
1049+
10661050
for (uint8_t const &Byte : BF.getLSDATypeIndexTable())
10671051
Streamer.emitIntValue(Byte, 1);
10681052
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,10 @@ void UseAfterMoveFinder::getReinits(
315315
"::std::unordered_map", "::std::unordered_multiset",
316316
"::std::unordered_multimap"))))));
317317

318-
auto StandardSmartPointerTypeMatcher = hasType(hasUnqualifiedDesugaredType(
319-
recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
320-
"::std::unique_ptr", "::std::shared_ptr", "::std::weak_ptr"))))));
318+
auto StandardResettableOwnerTypeMatcher = hasType(
319+
hasUnqualifiedDesugaredType(recordType(hasDeclaration(cxxRecordDecl(
320+
hasAnyName("::std::unique_ptr", "::std::shared_ptr",
321+
"::std::weak_ptr", "::std::optional", "::std::any"))))));
321322

322323
// Matches different types of reinitialization.
323324
auto ReinitMatcher =
@@ -340,7 +341,7 @@ void UseAfterMoveFinder::getReinits(
340341
callee(cxxMethodDecl(hasAnyName("clear", "assign")))),
341342
// reset() on standard smart pointers.
342343
cxxMemberCallExpr(
343-
on(expr(DeclRefMatcher, StandardSmartPointerTypeMatcher)),
344+
on(expr(DeclRefMatcher, StandardResettableOwnerTypeMatcher)),
344345
callee(cxxMethodDecl(hasName("reset")))),
345346
// Methods that have the [[clang::reinitializes]] attribute.
346347
cxxMemberCallExpr(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static bool checkOverridingFunctionReturnType(const ASTContext *Context,
112112

113113
// The class type D should have the same cv-qualification as or less
114114
// cv-qualification than the class type B.
115-
if (DTy.isMoreQualifiedThan(BTy))
115+
if (DTy.isMoreQualifiedThan(BTy, *Context))
116116
return false;
117117

118118
return true;

clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,11 @@ static bool applyDiceHeuristic(StringRef Arg, StringRef Param,
299299

300300
/// Checks if ArgType binds to ParamType regarding reference-ness and
301301
/// cv-qualifiers.
302-
static bool areRefAndQualCompatible(QualType ArgType, QualType ParamType) {
302+
static bool areRefAndQualCompatible(QualType ArgType, QualType ParamType,
303+
const ASTContext &Ctx) {
303304
return !ParamType->isReferenceType() ||
304305
ParamType.getNonReferenceType().isAtLeastAsQualifiedAs(
305-
ArgType.getNonReferenceType());
306+
ArgType.getNonReferenceType(), Ctx);
306307
}
307308

308309
static bool isPointerOrArray(QualType TypeToCheck) {
@@ -311,12 +312,12 @@ static bool isPointerOrArray(QualType TypeToCheck) {
311312

312313
/// Checks whether ArgType is an array type identical to ParamType's array type.
313314
/// Enforces array elements' qualifier compatibility as well.
314-
static bool isCompatibleWithArrayReference(QualType ArgType,
315-
QualType ParamType) {
315+
static bool isCompatibleWithArrayReference(QualType ArgType, QualType ParamType,
316+
const ASTContext &Ctx) {
316317
if (!ArgType->isArrayType())
317318
return false;
318319
// Here, qualifiers belong to the elements of the arrays.
319-
if (!ParamType.isAtLeastAsQualifiedAs(ArgType))
320+
if (!ParamType.isAtLeastAsQualifiedAs(ArgType, Ctx))
320321
return false;
321322

322323
return ParamType.getUnqualifiedType() == ArgType.getUnqualifiedType();
@@ -342,12 +343,13 @@ static QualType convertToPointeeOrArrayElementQualType(QualType TypeToConvert) {
342343
/// every * in ParamType to the right of that cv-qualifier, except the last
343344
/// one, must also be const-qualified.
344345
static bool arePointersStillQualCompatible(QualType ArgType, QualType ParamType,
345-
bool &IsParamContinuouslyConst) {
346+
bool &IsParamContinuouslyConst,
347+
const ASTContext &Ctx) {
346348
// The types are compatible, if the parameter is at least as qualified as the
347349
// argument, and if it is more qualified, it has to be const on upper pointer
348350
// levels.
349351
bool AreTypesQualCompatible =
350-
ParamType.isAtLeastAsQualifiedAs(ArgType) &&
352+
ParamType.isAtLeastAsQualifiedAs(ArgType, Ctx) &&
351353
(!ParamType.hasQualifiers() || IsParamContinuouslyConst);
352354
// Check whether the parameter's constness continues at the current pointer
353355
// level.
@@ -359,9 +361,10 @@ static bool arePointersStillQualCompatible(QualType ArgType, QualType ParamType,
359361
/// Checks whether multilevel pointers are compatible in terms of levels,
360362
/// qualifiers and pointee type.
361363
static bool arePointerTypesCompatible(QualType ArgType, QualType ParamType,
362-
bool IsParamContinuouslyConst) {
364+
bool IsParamContinuouslyConst,
365+
const ASTContext &Ctx) {
363366
if (!arePointersStillQualCompatible(ArgType, ParamType,
364-
IsParamContinuouslyConst))
367+
IsParamContinuouslyConst, Ctx))
365368
return false;
366369

367370
do {
@@ -372,7 +375,7 @@ static bool arePointerTypesCompatible(QualType ArgType, QualType ParamType,
372375
// Check whether cv-qualifiers permit compatibility on
373376
// current level.
374377
if (!arePointersStillQualCompatible(ArgType, ParamType,
375-
IsParamContinuouslyConst))
378+
IsParamContinuouslyConst, Ctx))
376379
return false;
377380

378381
if (ParamType.getUnqualifiedType() == ArgType.getUnqualifiedType())
@@ -396,7 +399,7 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
396399
return true;
397400

398401
// Check for constness and reference compatibility.
399-
if (!areRefAndQualCompatible(ArgType, ParamType))
402+
if (!areRefAndQualCompatible(ArgType, ParamType, Ctx))
400403
return false;
401404

402405
bool IsParamReference = ParamType->isReferenceType();
@@ -434,7 +437,7 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
434437
// When ParamType is an array reference, ArgType has to be of the same-sized
435438
// array-type with cv-compatible element type.
436439
if (IsParamReference && ParamType->isArrayType())
437-
return isCompatibleWithArrayReference(ArgType, ParamType);
440+
return isCompatibleWithArrayReference(ArgType, ParamType, Ctx);
438441

439442
bool IsParamContinuouslyConst =
440443
!IsParamReference || ParamType.getNonReferenceType().isConstQualified();
@@ -444,7 +447,7 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
444447
ParamType = convertToPointeeOrArrayElementQualType(ParamType);
445448

446449
// Check qualifier compatibility on the next level.
447-
if (!ParamType.isAtLeastAsQualifiedAs(ArgType))
450+
if (!ParamType.isAtLeastAsQualifiedAs(ArgType, Ctx))
448451
return false;
449452

450453
if (ParamType.getUnqualifiedType() == ArgType.getUnqualifiedType())
@@ -472,8 +475,8 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
472475
if (!(ParamType->isAnyPointerType() && ArgType->isAnyPointerType()))
473476
return false;
474477

475-
return arePointerTypesCompatible(ArgType, ParamType,
476-
IsParamContinuouslyConst);
478+
return arePointerTypesCompatible(ArgType, ParamType, IsParamContinuouslyConst,
479+
Ctx);
477480
}
478481

479482
static bool isOverloadedUnaryOrBinarySymbolOperator(const FunctionDecl *FD) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ Changes in existing checks
194194
<clang-tidy/checks/bugprone/unsafe-functions>` check to allow specifying
195195
additional functions to match.
196196

197+
- Improved :doc:`bugprone-use-after-move
198+
<clang-tidy/checks/bugprone/use-after-move>` to avoid triggering on
199+
``reset()`` calls on moved-from ``std::optional`` and ``std::any`` objects,
200+
similarly to smart pointers.
201+
197202
- Improved :doc:`cert-flp30-c <clang-tidy/checks/cert/flp30-c>` check to
198203
fix false positive that floating point variable is only used in increment
199204
expression.

0 commit comments

Comments
 (0)