Skip to content

Commit 9fab82a

Browse files
authored
Merge branch 'main' into amo1
2 parents 766d7bd + 4b805e1 commit 9fab82a

File tree

970 files changed

+41269
-26345
lines changed

Some content is hidden

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

970 files changed

+41269
-26345
lines changed

.github/workflows/bazel-checks.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ jobs:
3333
3434
bazel-build:
3535
name: "Bazel Build/Test"
36-
runs-on: llvm-premerge-linux-runners
36+
# Only run on US Central workers so we only have to keep one cache warm as
37+
# the cache buckets are per cluster.
38+
runs-on:
39+
group: llvm-premerge-cluster-us-central
40+
labels: llvm-premerge-linux-runners
3741
if: github.repository == 'llvm/llvm-project'
3842
steps:
3943
- name: Fetch LLVM sources
@@ -44,7 +48,7 @@ jobs:
4448
- name: Setup System Dependencies
4549
run: |
4650
sudo apt-get update
47-
sudo apt-get install -y libmpfr-dev libpfm4-dev
51+
sudo apt-get install -y libmpfr-dev libpfm4-dev m4 libedit-dev
4852
sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb > /tmp/bazelisk.deb
4953
sudo apt-get install -y /tmp/bazelisk.deb
5054
rm /tmp/bazelisk.deb
@@ -54,4 +58,4 @@ jobs:
5458
bazelisk test --config=ci --sandbox_base="" \
5559
--remote_cache=https://storage.googleapis.com/$CACHE_GCS_BUCKET-bazel \
5660
--google_default_credentials \
57-
@llvm-project//llvm/unittests:adt_tests
61+
@llvm-project//... //...

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
if: github.repository_owner == 'llvm'
8585
needs: abi-dump-setup
8686
runs-on: ubuntu-24.04
87+
container:
88+
image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:f80125c0f767e29b8616210c0fd5cea2cd1f4fb6f2ca86d89f6016b6329b8d7f" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f
8789
strategy:
8890
matrix:
8991
name:
@@ -101,17 +103,6 @@ jobs:
101103
steps:
102104
- name: Install Ninja
103105
uses: llvm/actions/install-ninja@42d80571b13f4599bbefbc7189728b64723c7f78 # main
104-
- name: Install abi-compliance-checker
105-
run: |
106-
sudo apt-get update
107-
sudo apt-get install -y abi-dumper autoconf pkg-config
108-
- name: Install universal-ctags
109-
run: |
110-
git clone https://github.com/universal-ctags/ctags.git
111-
cd ctags
112-
./autogen.sh
113-
./configure
114-
sudo make install
115106
- name: Download source code
116107
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
117108
with:
@@ -139,6 +130,8 @@ jobs:
139130
abi-compare:
140131
if: github.repository_owner == 'llvm'
141132
runs-on: ubuntu-24.04
133+
container:
134+
image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:f80125c0f767e29b8616210c0fd5cea2cd1f4fb6f2ca86d89f6016b6329b8d7f" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f
142135
needs:
143136
- abi-dump-setup
144137
- abi-dump
@@ -154,10 +147,6 @@ jobs:
154147
name: build-latest
155148
path: build-latest
156149

157-
- name: Install abi-compliance-checker
158-
run: |
159-
sudo apt-get update
160-
sudo apt-get install -y abi-compliance-checker
161150
- name: Compare ABI
162151
run: |
163152
for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,6 @@ jobs:
191191
- name: Install Ninja
192192
uses: llvm/actions/install-ninja@42d80571b13f4599bbefbc7189728b64723c7f78 # main
193193

194-
- name: Setup Windows
195-
if: startsWith(runner.os, 'Windows')
196-
uses: llvm/actions/setup-windows@42d80571b13f4599bbefbc7189728b64723c7f78 # main
197-
with:
198-
arch: amd64
199-
200194
- name: Set Build Prefix
201195
id: setup-stage
202196
shell: bash

clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
269269
return;
270270
}
271271
break;
272+
case CK_BaseToDerived:
273+
if (!needsConstCast(SourceType, DestType)) {
274+
ReplaceWithNamedCast("static_cast");
275+
return;
276+
}
277+
break;
272278
default:
273279
break;
274280
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ CoroutineHostileRAIICheck::CoroutineHostileRAIICheck(StringRef Name,
7373
RAIITypesList(utils::options::parseStringList(
7474
Options.get("RAIITypesList", "std::lock_guard;std::scoped_lock"))),
7575
AllowedAwaitablesList(utils::options::parseStringList(
76-
Options.get("AllowedAwaitablesList", ""))) {}
76+
Options.get("AllowedAwaitablesList", ""))),
77+
AllowedCallees(
78+
utils::options::parseStringList(Options.get("AllowedCallees", ""))) {}
7779

7880
void CoroutineHostileRAIICheck::registerMatchers(MatchFinder *Finder) {
7981
// A suspension happens with co_await or co_yield.
8082
auto ScopedLockable = varDecl(hasType(hasCanonicalType(hasDeclaration(
8183
hasAttr(attr::Kind::ScopedLockable)))))
8284
.bind("scoped-lockable");
8385
auto OtherRAII = varDecl(typeWithNameIn(RAIITypesList)).bind("raii");
84-
auto AllowedSuspend = awaitable(typeWithNameIn(AllowedAwaitablesList));
86+
auto AllowedSuspend = awaitable(
87+
anyOf(typeWithNameIn(AllowedAwaitablesList),
88+
callExpr(callee(functionDecl(hasAnyName(AllowedCallees))))));
8589
Finder->addMatcher(
8690
expr(anyOf(coawaitExpr(unless(AllowedSuspend)), coyieldExpr()),
8791
forEachPrevStmt(
@@ -111,5 +115,7 @@ void CoroutineHostileRAIICheck::storeOptions(
111115
utils::options::serializeStringList(RAIITypesList));
112116
Options.store(Opts, "SafeAwaitableList",
113117
utils::options::serializeStringList(AllowedAwaitablesList));
118+
Options.store(Opts, "SafeCallees",
119+
utils::options::serializeStringList(AllowedCallees));
114120
}
115121
} // namespace clang::tidy::misc

clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class CoroutineHostileRAIICheck : public ClangTidyCheck {
4646
// List of fully qualified awaitable types which are considered safe to
4747
// co_await.
4848
std::vector<StringRef> AllowedAwaitablesList;
49+
// List of callees whose return values are considered safe to directly
50+
// co_await.
51+
std::vector<StringRef> AllowedCallees;
4952
};
5053

5154
} // namespace clang::tidy::misc

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ Changes in existing checks
402402
adding an option to allow pointer arithmetic via prefix/postfix increment or
403403
decrement operators.
404404

405+
- Improved :doc:`google-readability-casting
406+
<clang-tidy/checks/google/readability-casting>` check by adding fix-it
407+
notes for downcasts.
408+
405409
- Improved :doc:`llvm-prefer-isa-or-dyn-cast-in-conditionals
406410
<clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals>` check:
407411

@@ -419,6 +423,11 @@ Changes in existing checks
419423
positives on return of non-const pointer and fix false positives on
420424
pointer-to-member operator.
421425

426+
- Improved :doc:`misc-coroutine-hostile-raii
427+
<clang-tidy/checks/misc/coroutine-hostile-raii>` check by adding the option
428+
`AllowedCallees`, that allows exempting safely awaitable callees from the
429+
check.
430+
422431
- Improved :doc:`misc-header-include-cycle
423432
<clang-tidy/checks/misc/header-include-cycle>` check performance.
424433

clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,23 @@ Options
8181
Eg: `my::safe::awaitable;other::awaitable`
8282
Default is an empty string.
8383

84+
.. option:: AllowedCallees
85+
86+
A semicolon-separated list of callee function names which can
87+
be safely awaited while having hostile RAII objects in scope.
88+
Example usage:
89+
90+
.. code-block:: c++
91+
92+
// Consider option AllowedCallees = "noop"
93+
task noop() { co_return; }
94+
95+
task coro() {
96+
// This persists across the co_await but is not flagged
97+
// because the awaitable is considered safe to await on.
98+
const std::lock_guard l(&mu_);
99+
co_await noop();
100+
}
101+
102+
Eg: `my::safe::await;other::await`
103+
Default is an empty string.

clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
102102
// CHECK-FIXES: b1 = static_cast<int>(b);
103103

104104
Y *pB = (Y*)pX;
105-
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast/const_cast/reinterpret_cast [
105+
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast {{.*}}
106+
// CHECK-FIXES: Y *pB = static_cast<Y*>(pX);
106107
Y &rB = (Y&)*pX;
107-
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast/const_cast/reinterpret_cast [
108+
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast {{.*}}
109+
// CHECK-FIXES: Y &rB = static_cast<Y&>(*pX);
108110

109111
const char *pc3 = (const char*)cpv;
110112
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}}; use static_cast [

clang-tools-extra/test/clang-tidy/checkers/misc/coroutine-hostile-raii.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %check_clang_tidy -std=c++20 %s misc-coroutine-hostile-raii %t \
22
// RUN: -config="{CheckOptions: {\
33
// RUN: misc-coroutine-hostile-raii.RAIITypesList: 'my::Mutex; ::my::other::Mutex', \
4-
// RUN: misc-coroutine-hostile-raii.AllowedAwaitablesList: 'safe::awaitable; ::transformable::awaitable' \
4+
// RUN: misc-coroutine-hostile-raii.AllowedAwaitablesList: 'safe::awaitable; ::transformable::awaitable', \
5+
// RUN: misc-coroutine-hostile-raii.AllowedCallees: 'safe::AwaitFunc; ::safe::Obj::AwaitMethod' \
56
// RUN: }}"
67

78
namespace std {
@@ -145,12 +146,18 @@ namespace safe {
145146
void await_suspend(std::coroutine_handle<>) noexcept {}
146147
void await_resume() noexcept {}
147148
};
149+
std::suspend_always AwaitFunc();
150+
struct Obj {
151+
std::suspend_always AwaitMethod();
152+
};
148153
} // namespace safe
149154
ReturnObject RAIISafeSuspendTest() {
150155
absl::Mutex a;
151156
co_await safe::awaitable{};
152157
using other = safe::awaitable;
153158
co_await other{};
159+
co_await safe::AwaitFunc();
160+
co_await safe::Obj().AwaitMethod();
154161
}
155162

156163
// ================================================================================

0 commit comments

Comments
 (0)