Skip to content

Commit 604fc41

Browse files
committed
Merge remote-tracking branch 'llvm/release/19.x' into release_19.x_llvm-min-tblgen
2 parents 627b0de + 086d8e6 commit 604fc41

File tree

237 files changed

+4496
-2093
lines changed

Some content is hidden

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

237 files changed

+4496
-2093
lines changed

.github/workflows/release-binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ jobs:
420420
attestations: write # For artifact attestations
421421

422422
steps:
423+
- name: Checkout Release Scripts
424+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
425+
with:
426+
sparse-checkout: |
427+
llvm/utils/release/github-upload-release.py
428+
llvm/utils/git/requirements.txt
429+
sparse-checkout-cone-mode: false
430+
423431
- name: 'Download artifact'
424432
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
425433
with:
@@ -442,14 +450,6 @@ jobs:
442450
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
443451
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
444452

445-
- name: Checkout Release Scripts
446-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
447-
with:
448-
sparse-checkout: |
449-
llvm/utils/release/github-upload-release.py
450-
llvm/utils/git/requirements.txt
451-
sparse-checkout-cone-mode: false
452-
453453
- name: Install Python Requirements
454454
run: |
455455
pip install --require-hashes -r ./llvm/utils/git/requirements.txt

.github/workflows/release-documentation.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,20 @@ jobs:
7272
ref: main
7373
fetch-depth: 0
7474
path: www-releases
75+
persist-credentials: false
7576

7677
- name: Upload Release Notes
7778
if: env.upload
7879
env:
79-
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
80+
GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
8081
run: |
81-
mkdir -p ../www-releases/${{ inputs.release-version }}
82-
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
83-
cd ../www-releases
82+
mkdir -p www-releases/${{ inputs.release-version }}
83+
mv ./docs-build/html-export/* www-releases/${{ inputs.release-version }}
84+
cd www-releases
85+
git checkout -b ${{ inputs.release-version }}
8486
git add ${{ inputs.release-version }}
8587
git config user.email "[email protected]"
8688
git config user.name "llvmbot"
8789
git commit -a -m "Add ${{ inputs.release-version }} documentation"
88-
git push "https://[email protected]/${{ github.repository_owner }}/www-releases" main:main
90+
git push --force "https://[email protected]/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
91+
gh pr create -f -B main -H ${{ inputs.release-version }} -R llvmbot/www-releases

clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
204204
ReplacerMap Results;
205205
static const Signature SingleSig = {{0}};
206206
static const Signature TwoSig = {{0}, {2}};
207-
static const auto AddFrom =
207+
const auto AddFrom =
208208
[&Results](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
209209
std::initializer_list<StringRef> Names, StringRef Prefix) {
210210
llvm::SmallString<64> Buffer;
@@ -214,17 +214,17 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
214214
}
215215
};
216216

217-
static const auto AddFromStd =
218-
[](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
219-
std::initializer_list<StringRef> Names) {
217+
const auto AddFromStd =
218+
[&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
219+
std::initializer_list<StringRef> Names) {
220220
AddFrom(Replacer, Names, "std");
221221
};
222222

223-
static const auto AddFromBoost =
224-
[](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
225-
std::initializer_list<
226-
std::pair<StringRef, std::initializer_list<StringRef>>>
227-
NamespaceAndNames) {
223+
const auto AddFromBoost =
224+
[&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
225+
std::initializer_list<
226+
std::pair<StringRef, std::initializer_list<StringRef>>>
227+
NamespaceAndNames) {
228228
for (auto [Namespace, Names] : NamespaceAndNames)
229229
AddFrom(Replacer, Names,
230230
SmallString<64>{"boost", (Namespace.empty() ? "" : "::"),

clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,22 @@ TEST_F(LSPTest, ClangTidyRename) {
262262
EXPECT_EQ(Params, std::vector{llvm::json::Value(std::move(ExpectedEdit))});
263263
}
264264

265+
TEST_F(LSPTest, ClangTidyCrash_Issue109367) {
266+
// This test requires clang-tidy checks to be linked in.
267+
if (!CLANGD_TIDY_CHECKS)
268+
return;
269+
Opts.ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
270+
llvm::StringRef) {
271+
ClangTidyOpts.Checks = {"-*,boost-use-ranges"};
272+
};
273+
// Check that registering the boost-use-ranges checker's matchers
274+
// on two different threads does not cause a crash.
275+
auto &Client = start();
276+
Client.didOpen("a.cpp", "");
277+
Client.didOpen("b.cpp", "");
278+
Client.sync();
279+
}
280+
265281
TEST_F(LSPTest, IncomingCalls) {
266282
Annotations Code(R"cpp(
267283
void calle^e(int);

clang/cmake/caches/Release.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ set_final_stage_var(LLVM_ENABLE_PROJECTS "${LLVM_RELEASE_ENABLE_PROJECTS}" STRIN
101101
set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
102102
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
103103

104+
if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
105+
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
106+
endif()

clang/include/clang/AST/ExternalASTSource.h

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
#include "llvm/ADT/SmallVector.h"
2626
#include "llvm/ADT/iterator.h"
2727
#include "llvm/Support/PointerLikeTypeTraits.h"
28+
#include <algorithm>
2829
#include <cassert>
2930
#include <cstddef>
3031
#include <cstdint>
3132
#include <iterator>
33+
#include <new>
3234
#include <optional>
3335
#include <utility>
3436

@@ -326,45 +328,65 @@ struct LazyOffsetPtr {
326328
///
327329
/// If the low bit is clear, a pointer to the AST node. If the low
328330
/// bit is set, the upper 63 bits are the offset.
329-
mutable uint64_t Ptr = 0;
331+
static constexpr size_t DataSize = std::max(sizeof(uint64_t), sizeof(T *));
332+
alignas(uint64_t) alignas(T *) mutable unsigned char Data[DataSize] = {};
333+
334+
unsigned char GetLSB() const {
335+
return Data[llvm::sys::IsBigEndianHost ? DataSize - 1 : 0];
336+
}
337+
338+
template <typename U> U &As(bool New) const {
339+
unsigned char *Obj =
340+
Data + (llvm::sys::IsBigEndianHost ? DataSize - sizeof(U) : 0);
341+
if (New)
342+
return *new (Obj) U;
343+
return *std::launder(reinterpret_cast<U *>(Obj));
344+
}
345+
346+
T *&GetPtr() const { return As<T *>(false); }
347+
uint64_t &GetU64() const { return As<uint64_t>(false); }
348+
void SetPtr(T *Ptr) const { As<T *>(true) = Ptr; }
349+
void SetU64(uint64_t U64) const { As<uint64_t>(true) = U64; }
330350

331351
public:
332352
LazyOffsetPtr() = default;
333-
explicit LazyOffsetPtr(T *Ptr) : Ptr(reinterpret_cast<uint64_t>(Ptr)) {}
353+
explicit LazyOffsetPtr(T *Ptr) : Data() { SetPtr(Ptr); }
334354

335-
explicit LazyOffsetPtr(uint64_t Offset) : Ptr((Offset << 1) | 0x01) {
355+
explicit LazyOffsetPtr(uint64_t Offset) : Data() {
336356
assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
337357
if (Offset == 0)
338-
Ptr = 0;
358+
SetPtr(nullptr);
359+
else
360+
SetU64((Offset << 1) | 0x01);
339361
}
340362

341363
LazyOffsetPtr &operator=(T *Ptr) {
342-
this->Ptr = reinterpret_cast<uint64_t>(Ptr);
364+
SetPtr(Ptr);
343365
return *this;
344366
}
345367

346368
LazyOffsetPtr &operator=(uint64_t Offset) {
347369
assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
348370
if (Offset == 0)
349-
Ptr = 0;
371+
SetPtr(nullptr);
350372
else
351-
Ptr = (Offset << 1) | 0x01;
373+
SetU64((Offset << 1) | 0x01);
352374

353375
return *this;
354376
}
355377

356378
/// Whether this pointer is non-NULL.
357379
///
358380
/// This operation does not require the AST node to be deserialized.
359-
explicit operator bool() const { return Ptr != 0; }
381+
explicit operator bool() const { return isOffset() || GetPtr() != nullptr; }
360382

361383
/// Whether this pointer is non-NULL.
362384
///
363385
/// This operation does not require the AST node to be deserialized.
364-
bool isValid() const { return Ptr != 0; }
386+
bool isValid() const { return isOffset() || GetPtr() != nullptr; }
365387

366388
/// Whether this pointer is currently stored as an offset.
367-
bool isOffset() const { return Ptr & 0x01; }
389+
bool isOffset() const { return GetLSB() & 0x01; }
368390

369391
/// Retrieve the pointer to the AST node that this lazy pointer points to.
370392
///
@@ -375,17 +397,17 @@ struct LazyOffsetPtr {
375397
if (isOffset()) {
376398
assert(Source &&
377399
"Cannot deserialize a lazy pointer without an AST source");
378-
Ptr = reinterpret_cast<uint64_t>((Source->*Get)(OffsT(Ptr >> 1)));
400+
SetPtr((Source->*Get)(OffsT(GetU64() >> 1)));
379401
}
380-
return reinterpret_cast<T*>(Ptr);
402+
return GetPtr();
381403
}
382404

383405
/// Retrieve the address of the AST node pointer. Deserializes the pointee if
384406
/// necessary.
385407
T **getAddressOfPointer(ExternalASTSource *Source) const {
386408
// Ensure the integer is in pointer form.
387409
(void)get(Source);
388-
return reinterpret_cast<T**>(&Ptr);
410+
return &GetPtr();
389411
}
390412
};
391413

0 commit comments

Comments
 (0)