Skip to content

Commit c79da8c

Browse files
authored
Merge branch 'main' into misc_splat_to_broadcast_textual
2 parents 6f4fd33 + bd9117c commit c79da8c

File tree

233 files changed

+19296
-2203
lines changed

Some content is hidden

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

233 files changed

+19296
-2203
lines changed

.ci/generate_test_report_github.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44
"""Script to generate a build report for Github."""
55

66
import argparse
7+
import platform
78

89
import generate_test_report_lib
910

11+
PLATFORM_TITLES = {
12+
"Windows": ":window: Windows x64 Test Results",
13+
"Linux": ":penguin: Linux x64 Test Results",
14+
}
15+
1016
if __name__ == "__main__":
1117
parser = argparse.ArgumentParser()
12-
parser.add_argument(
13-
"title", help="Title of the test report, without Markdown formatting."
14-
)
1518
parser.add_argument("return_code", help="The build's return code.", type=int)
1619
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
1720
args = parser.parse_args()
1821

1922
report = generate_test_report_lib.generate_report_from_files(
20-
args.title, args.return_code, args.junit_files
23+
PLATFORM_TITLES[platform.system()], args.return_code, args.junit_files
2124
)
2225

2326
print(report)

.ci/monolithic-linux.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,25 @@ function at-exit {
3838
# If building fails there will be no results files.
3939
shopt -s nullglob
4040

41-
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":penguin: Linux x64 Test Results" \
42-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
41+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
42+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
43+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
44+
fi
4345
}
4446
trap at-exit EXIT
4547

48+
function start-group {
49+
groupname=$1
50+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
51+
echo "::endgroup"
52+
echo "::group::$groupname"
53+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
54+
echo "@@@$STEP@@@"
55+
else
56+
echo "Starting $groupname"
57+
fi
58+
}
59+
4660
projects="${1}"
4761
targets="${2}"
4862
runtimes="${3}"
@@ -52,7 +66,7 @@ enable_cir="${6}"
5266

5367
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5468

55-
echo "::group::cmake"
69+
start-group "CMake"
5670
export PIP_BREAK_SYSTEM_PACKAGES=1
5771
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
5872

@@ -83,49 +97,39 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
8397
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
8498
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
8599

86-
echo "::endgroup::"
87-
echo "::group::ninja"
100+
start-group "ninja"
88101

89102
# Targets are not escaped as they are passed as separate arguments.
90103
ninja -C "${BUILD_DIR}" -k 0 ${targets}
91104

92-
echo "::endgroup::"
93-
94105
if [[ "${runtime_targets}" != "" ]]; then
95-
echo "::group::ninja runtimes"
106+
start-group "ninja Runtimes"
96107

97108
ninja -C "${BUILD_DIR}" ${runtime_targets}
98-
99-
echo "::endgroup::"
100109
fi
101110

102111
# Compiling runtimes with just-built Clang and running their tests
103112
# as an additional testing for Clang.
104113
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
105-
echo "::group::cmake runtimes C++26"
114+
start-group "CMake Runtimes C++26"
106115

107116
cmake \
108117
-D LIBCXX_TEST_PARAMS="std=c++26" \
109118
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
110119
"${BUILD_DIR}"
111120

112-
echo "::endgroup::"
113-
echo "::group::ninja runtimes C++26"
121+
start-group "ninja Runtimes C++26"
114122

115123
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
116124

117-
echo "::endgroup::"
118-
echo "::group::cmake runtimes clang modules"
125+
start-group "CMake Runtimes Clang Modules"
119126

120127
cmake \
121128
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
122129
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
123130
"${BUILD_DIR}"
124131

125-
echo "::endgroup::"
126-
echo "::group::ninja runtimes clang modules"
132+
start-group "ninja Runtimes Clang Modules"
127133

128134
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
129-
130-
echo "::endgroup::"
131135
fi

.ci/monolithic-windows.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,30 @@ function at-exit {
3232

3333
# If building fails there will be no results files.
3434
shopt -s nullglob
35-
36-
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py ":window: Windows x64 Test Results" \
37-
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
35+
36+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
37+
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
38+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
39+
fi
3840
}
3941
trap at-exit EXIT
4042

43+
function start-group {
44+
groupname=$1
45+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
46+
echo "::endgroup"
47+
echo "::group::$groupname"
48+
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
49+
echo "@@@$STEP@@@"
50+
else
51+
echo "Starting $groupname"
52+
fi
53+
}
54+
4155
projects="${1}"
4256
targets="${2}"
4357

44-
echo "::group::cmake"
58+
start-group "CMake"
4559
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
4660

4761
export CC=cl
@@ -71,10 +85,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7185
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7286
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
7387

74-
echo "::endgroup::"
75-
echo "::group::ninja"
88+
start-group "ninja"
7689

7790
# Targets are not escaped as they are passed as separate arguments.
7891
ninja -C "${BUILD_DIR}" -k 0 ${targets}
79-
80-
echo "::endgroup"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ jobs:
260260
- name: Install a current LLVM
261261
if: ${{ matrix.mingw != true }}
262262
run: |
263-
choco install -y llvm --version=19.1.7 --allow-downgrade
263+
choco install -y llvm --version=20.1.8 --allow-downgrade
264264
- name: Install llvm-mingw
265265
if: ${{ matrix.mingw == true }}
266266
run: |
267-
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-x86_64.zip
267+
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/llvm-mingw-20250709-ucrt-x86_64.zip
268268
powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
269269
del llvm-mingw*.zip
270270
mv llvm-mingw* c:\llvm-mingw

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ Bug Fixes to Attribute Support
172172

173173
- ``[[nodiscard]]`` is now respected on Objective-C and Objective-C++ methods.
174174
(#GH141504)
175+
- Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with
176+
``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520)
175177

176178
Bug Fixes to C++ Support
177179
^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5997,6 +5997,23 @@ bool Compiler<Emitter>::checkLiteralType(const Expr *E) {
59975997
return this->emitCheckLiteralType(E->getType().getTypePtr(), E);
59985998
}
59995999

6000+
static bool initNeedsOverridenLoc(const CXXCtorInitializer *Init) {
6001+
const Expr *InitExpr = Init->getInit();
6002+
6003+
if (!Init->isWritten() && !Init->isInClassMemberInitializer() &&
6004+
!isa<CXXConstructExpr>(InitExpr))
6005+
return true;
6006+
6007+
if (const auto *CE = dyn_cast<CXXConstructExpr>(InitExpr)) {
6008+
const CXXConstructorDecl *Ctor = CE->getConstructor();
6009+
if (Ctor->isDefaulted() && Ctor->isCopyOrMoveConstructor() &&
6010+
Ctor->isTrivial())
6011+
return true;
6012+
}
6013+
6014+
return false;
6015+
}
6016+
60006017
template <class Emitter>
60016018
bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
60026019
assert(!ReturnType);
@@ -6071,10 +6088,7 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
60716088
const Record::Field *F = R->getField(Member);
60726089

60736090
LocOverrideScope<Emitter> LOS(this, SourceInfo{},
6074-
!Init->isWritten() &&
6075-
!Init->isInClassMemberInitializer() &&
6076-
(!isa<CXXConstructExpr>(InitExpr) ||
6077-
Member->isAnonymousStructOrUnion()));
6091+
initNeedsOverridenLoc(Init));
60786092
if (!emitFieldInitializer(F, F->Offset, InitExpr, IsUnion))
60796093
return false;
60806094
} else if (const Type *Base = Init->getBaseClass()) {
@@ -6104,10 +6118,7 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
61046118
return false;
61056119
} else if (const IndirectFieldDecl *IFD = Init->getIndirectMember()) {
61066120
LocOverrideScope<Emitter> LOS(this, SourceInfo{},
6107-
!Init->isWritten() &&
6108-
!Init->isInClassMemberInitializer() &&
6109-
!isa<CXXConstructExpr>(InitExpr));
6110-
6121+
initNeedsOverridenLoc(Init));
61116122
assert(IFD->getChainingSize() >= 2);
61126123

61136124
unsigned NestedFieldOffset = 0;

clang/lib/AST/ByteCode/InterpFrame.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ static bool shouldSkipInBacktrace(const Function *F) {
133133
MD && MD->getParent()->isAnonymousStructOrUnion())
134134
return true;
135135

136+
if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(FD);
137+
Ctor && Ctor->isDefaulted() && Ctor->isTrivial() &&
138+
Ctor->isCopyOrMoveConstructor() && Ctor->inits().empty())
139+
return true;
140+
136141
return false;
137142
}
138143

clang/lib/AST/ExprConstant.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9860,11 +9860,15 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
98609860
if (Value.isInt()) {
98619861
unsigned Size = Info.Ctx.getTypeSize(E->getType());
98629862
uint64_t N = Value.getInt().extOrTrunc(Size).getZExtValue();
9863-
Result.Base = (Expr*)nullptr;
9864-
Result.InvalidBase = false;
9865-
Result.Offset = CharUnits::fromQuantity(N);
9866-
Result.Designator.setInvalid();
9867-
Result.IsNullPtr = false;
9863+
if (N == Info.Ctx.getTargetNullPointerValue(E->getType())) {
9864+
Result.setNull(Info.Ctx, E->getType());
9865+
} else {
9866+
Result.Base = (Expr *)nullptr;
9867+
Result.InvalidBase = false;
9868+
Result.Offset = CharUnits::fromQuantity(N);
9869+
Result.Designator.setInvalid();
9870+
Result.IsNullPtr = false;
9871+
}
98689872
return true;
98699873
} else {
98709874
// In rare instances, the value isn't an lvalue.

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,8 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
13071307
}
13081308

13091309
case Decl::Var:
1310-
case Decl::Decomposition: {
1310+
case Decl::Decomposition:
1311+
case Decl::VarTemplateSpecialization: {
13111312
auto *vd = cast<VarDecl>(decl);
13121313
if (isa<DecompositionDecl>(decl)) {
13131314
errorNYI(decl->getSourceRange(), "global variable decompositions");
@@ -1342,6 +1343,8 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
13421343
case Decl::StaticAssert:
13431344
case Decl::TypeAliasTemplate:
13441345
case Decl::UsingShadow:
1346+
case Decl::VarTemplate:
1347+
case Decl::VarTemplatePartialSpecialization:
13451348
break;
13461349

13471350
case Decl::CXXConstructor:

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,11 @@ namespace {
599599
llvm::Constant *CleanupFn;
600600
const CGFunctionInfo &FnInfo;
601601
const VarDecl &Var;
602+
const CleanupAttr *Attribute;
602603

603604
CallCleanupFunction(llvm::Constant *CleanupFn, const CGFunctionInfo *Info,
604-
const VarDecl *Var)
605-
: CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var) {}
605+
const VarDecl *Var, const CleanupAttr *Attr)
606+
: CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var), Attribute(Attr) {}
606607

607608
void Emit(CodeGenFunction &CGF, Flags flags) override {
608609
DeclRefExpr DRE(CGF.getContext(), const_cast<VarDecl *>(&Var), false,
@@ -624,8 +625,11 @@ namespace {
624625
CallArgList Args;
625626
Args.add(RValue::get(Arg),
626627
CGF.getContext().getPointerType(Var.getType()));
627-
auto Callee = CGCallee::forDirect(CleanupFn);
628-
CGF.EmitCall(FnInfo, Callee, ReturnValueSlot(), Args);
628+
GlobalDecl GD = GlobalDecl(Attribute->getFunctionDecl());
629+
auto Callee = CGCallee::forDirect(CleanupFn, CGCalleeInfo(GD));
630+
CGF.EmitCall(FnInfo, Callee, ReturnValueSlot(), Args,
631+
/*callOrInvoke*/ nullptr, /*IsMustTail*/ false,
632+
Attribute->getLoc());
629633
}
630634
};
631635
} // end anonymous namespace
@@ -2231,7 +2235,8 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
22312235
assert(F && "Could not find function!");
22322236

22332237
const CGFunctionInfo &Info = CGM.getTypes().arrangeFunctionDeclaration(FD);
2234-
EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, F, &Info, &D);
2238+
EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, F, &Info, &D,
2239+
CA);
22352240
}
22362241

22372242
// If this is a block variable, call _Block_object_destroy

0 commit comments

Comments
 (0)