Skip to content

Commit 20536fe

Browse files
authored
Merge branch 'main' into users/ilovepi/clang-doc-trace-fix
2 parents 7f346f4 + 16994a6 commit 20536fe

File tree

679 files changed

+16669
-7365
lines changed

Some content is hidden

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

679 files changed

+16669
-7365
lines changed

.ci/metrics/metrics.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,7 @@ def github_get_metrics(
349349
running_count[metric_name] += 1
350350
continue
351351

352-
job_result = int(job.conclusion == "success")
353-
if job_result:
354-
# We still might want to mark the job as a failure if one of the steps
355-
# failed. This is required due to use setting continue-on-error in
356-
# the premerge pipeline to prevent sending emails while we are
357-
# testing the infrastructure.
358-
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
359-
# longer in a testing state and we can directly assert the workflow
360-
# result.
361-
for step in job.steps:
362-
if step.conclusion != "success" and step.conclusion != "skipped":
363-
job_result = 0
364-
break
352+
job_result = int(job.conclusion == "success" or job.conclusion == "skipped")
365353

366354
created_at = job.created_at
367355
started_at = job.started_at

.ci/monolithic-linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function at-exit {
3838

3939
ccache --print-stats > artifacts/ccache_stats.txt
4040
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
41+
cp "${BUILD_DIR}"/test-results.*.xml artifacts/
4142

4243
# If building fails there will be no results files.
4344
shopt -s nullglob

.ci/monolithic-windows.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function at-exit {
3333
mkdir -p artifacts
3434
sccache --show-stats >> artifacts/sccache_stats.txt
3535
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
36+
cp "${BUILD_DIR}"/test-results.*.xml artifacts/
3637

3738
# If building fails there will be no results files.
3839
shopt -s nullglob

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
**/crash_diagnostics/*
185185
186186
macos:
187-
needs: [ stage3 ]
187+
needs: [ stage2 ]
188188
strategy:
189189
fail-fast: false
190190
matrix:

.github/workflows/pr-code-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install clang-format
5656
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
5757
with:
58-
clangformat: 19.1.6
58+
clangformat: 20.1.5
5959

6060
- name: Setup Python env
6161
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0

bolt/Maintainers.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ N: Vladislav Khmelevsky
2020
2121
D: AArch64 backend
2222

23+
N: Paschalis Mpeis
24+
25+
D: AArch64 backend
26+
2327
N: Job Noorman
2428
2529
D: RISC-V backend

clang/cmake/caches/Apple-stage1.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "")
1818
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
1919
set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
2020
set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
21-
set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
21+
set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
2222
set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
2323
set(CLANG_SPAWN_CC1 ON CACHE BOOL "")
2424
set(CLANG_BOOTSTRAP_PASSTHROUGH

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ Improvements to Clang's diagnostics
575575

576576
- ``-Wswitch`` will now diagnose unhandled enumerators in switches also when
577577
the enumerator is deprecated. Warnings about using deprecated enumerators in
578-
switch cases have moved behind a new ``-Wdeprecated-switch-case`` flag.
578+
switch cases have moved behind a new ``-Wdeprecated-declarations-switch-case``
579+
flag.
579580

580581
For example:
581582

@@ -598,7 +599,7 @@ Improvements to Clang's diagnostics
598599
The warning can be fixed either by adding a ``default:``, or by adding
599600
``case Blue:``. Since the enumerator is deprecated, the latter approach will
600601
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
601-
``-Wno-deprecated-switch-case``.
602+
``-Wno-deprecated-declarations-switch-case``.
602603

603604
Improvements to Clang's time-trace
604605
----------------------------------
@@ -820,6 +821,7 @@ Miscellaneous Clang Crashes Fixed
820821
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
821822

822823
- Fixed crash when ``-print-stats`` is enabled in compiling IR files. (#GH131608)
824+
- Fix code completion crash involving PCH serialzied templates. (#GH139019)
823825

824826
OpenACC Specific Changes
825827
------------------------

clang/docs/SanitizerSpecialCaseList.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ tool-specific docs.
156156

157157
.. code-block:: bash
158158
159-
# The line above is explained in the note above
160159
# Lines starting with # are ignored.
161160
# Turn off checks for the source file
162161
# Entries without sections are placed into [*] and apply to all sanitizers

clang/include/clang/AST/Expr.h

Lines changed: 86 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,13 @@ class DeclRefExpr final
13441344

13451345
SourceLocation getLocation() const { return DeclRefExprBits.Loc; }
13461346
void setLocation(SourceLocation L) { DeclRefExprBits.Loc = L; }
1347-
SourceLocation getBeginLoc() const LLVM_READONLY;
1347+
1348+
SourceLocation getBeginLoc() const {
1349+
if (hasQualifier())
1350+
return getQualifierLoc().getBeginLoc();
1351+
return DeclRefExprBits.Loc;
1352+
}
1353+
13481354
SourceLocation getEndLoc() const LLVM_READONLY;
13491355

13501356
/// Determine whether this declaration reference was preceded by a
@@ -2901,34 +2907,43 @@ class CallExpr : public Expr {
29012907
//
29022908
// * An optional of type FPOptionsOverride.
29032909
//
2904-
// Note that we store the offset in bytes from the this pointer to the start
2905-
// of the trailing objects. It would be perfectly possible to compute it
2906-
// based on the dynamic kind of the CallExpr. However 1.) we have plenty of
2907-
// space in the bit-fields of Stmt. 2.) It was benchmarked to be faster to
2908-
// compute this once and then load the offset from the bit-fields of Stmt,
2909-
// instead of re-computing the offset each time the trailing objects are
2910-
// accessed.
2910+
// CallExpr subclasses are asssumed to be 32 bytes or less, and CallExpr
2911+
// itself is 24 bytes. To avoid having to recompute or store the offset of the
2912+
// trailing objects, we put it at 32 bytes (such that it is suitable for all
2913+
// subclasses) We use the 8 bytes gap left for instances of CallExpr to store
2914+
// the begin source location, which has a significant impact on perf as
2915+
// getBeginLoc is assumed to be cheap.
2916+
// The layourt is as follow:
2917+
// CallExpr | Begin | 4 bytes left | Trailing Objects
2918+
// CXXMemberCallExpr | Trailing Objects
2919+
// A bit in CallExprBitfields indicates if source locations are present.
29112920

2921+
protected:
2922+
static constexpr unsigned OffsetToTrailingObjects = 32;
2923+
template <typename T>
2924+
static constexpr unsigned
2925+
sizeToAllocateForCallExprSubclass(unsigned SizeOfTrailingObjects) {
2926+
static_assert(sizeof(T) <= CallExpr::OffsetToTrailingObjects);
2927+
return SizeOfTrailingObjects + CallExpr::OffsetToTrailingObjects;
2928+
}
2929+
2930+
private:
29122931
/// Return a pointer to the start of the trailing array of "Stmt *".
29132932
Stmt **getTrailingStmts() {
29142933
return reinterpret_cast<Stmt **>(reinterpret_cast<char *>(this) +
2915-
CallExprBits.OffsetToTrailingObjects);
2934+
OffsetToTrailingObjects);
29162935
}
29172936
Stmt *const *getTrailingStmts() const {
29182937
return const_cast<CallExpr *>(this)->getTrailingStmts();
29192938
}
29202939

2921-
/// Map a statement class to the appropriate offset in bytes from the
2922-
/// this pointer to the trailing objects.
2923-
static unsigned offsetToTrailingObjects(StmtClass SC);
2924-
29252940
unsigned getSizeOfTrailingStmts() const {
29262941
return (1 + getNumPreArgs() + getNumArgs()) * sizeof(Stmt *);
29272942
}
29282943

29292944
size_t getOffsetOfTrailingFPFeatures() const {
29302945
assert(hasStoredFPFeatures());
2931-
return CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts();
2946+
return OffsetToTrailingObjects + getSizeOfTrailingStmts();
29322947
}
29332948

29342949
public:
@@ -2975,14 +2990,14 @@ class CallExpr : public Expr {
29752990
FPOptionsOverride *getTrailingFPFeatures() {
29762991
assert(hasStoredFPFeatures());
29772992
return reinterpret_cast<FPOptionsOverride *>(
2978-
reinterpret_cast<char *>(this) + CallExprBits.OffsetToTrailingObjects +
2993+
reinterpret_cast<char *>(this) + OffsetToTrailingObjects +
29792994
getSizeOfTrailingStmts());
29802995
}
29812996
const FPOptionsOverride *getTrailingFPFeatures() const {
29822997
assert(hasStoredFPFeatures());
29832998
return reinterpret_cast<const FPOptionsOverride *>(
2984-
reinterpret_cast<const char *>(this) +
2985-
CallExprBits.OffsetToTrailingObjects + getSizeOfTrailingStmts());
2999+
reinterpret_cast<const char *>(this) + OffsetToTrailingObjects +
3000+
getSizeOfTrailingStmts());
29863001
}
29873002

29883003
public:
@@ -3028,6 +3043,19 @@ class CallExpr : public Expr {
30283043

30293044
bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; }
30303045

3046+
bool usesMemberSyntax() const {
3047+
return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax;
3048+
}
3049+
void setUsesMemberSyntax(bool V = true) {
3050+
CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = V;
3051+
// Because the source location may be different for explicit
3052+
// member, we reset the cached values.
3053+
if (CallExprBits.HasTrailingSourceLoc) {
3054+
CallExprBits.HasTrailingSourceLoc = false;
3055+
updateTrailingSourceLoc();
3056+
}
3057+
}
3058+
30313059
bool isCoroElideSafe() const { return CallExprBits.IsCoroElideSafe; }
30323060
void setCoroElideSafe(bool V = true) { CallExprBits.IsCoroElideSafe = V; }
30333061

@@ -3187,9 +3215,48 @@ class CallExpr : public Expr {
31873215
SourceLocation getRParenLoc() const { return RParenLoc; }
31883216
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
31893217

3190-
SourceLocation getBeginLoc() const LLVM_READONLY;
3191-
SourceLocation getEndLoc() const LLVM_READONLY;
3218+
SourceLocation getBeginLoc() const {
3219+
if (CallExprBits.HasTrailingSourceLoc) {
3220+
static_assert(sizeof(CallExpr) <=
3221+
OffsetToTrailingObjects + sizeof(SourceLocation));
3222+
return *reinterpret_cast<const SourceLocation *>(
3223+
reinterpret_cast<const char *>(this + 1));
3224+
}
3225+
3226+
if (usesMemberSyntax())
3227+
if (auto FirstArgLoc = getArg(0)->getBeginLoc(); FirstArgLoc.isValid())
3228+
return FirstArgLoc;
3229+
3230+
// FIXME: Some builtins have no callee begin location
3231+
SourceLocation begin = getCallee()->getBeginLoc();
3232+
if (begin.isInvalid() && getNumArgs() > 0 && getArg(0))
3233+
begin = getArg(0)->getBeginLoc();
3234+
return begin;
3235+
}
3236+
3237+
SourceLocation getEndLoc() const { return getRParenLoc(); }
31923238

3239+
private:
3240+
friend class ASTStmtReader;
3241+
bool hasTrailingSourceLoc() const {
3242+
return CallExprBits.HasTrailingSourceLoc;
3243+
}
3244+
3245+
void updateTrailingSourceLoc() {
3246+
assert(!CallExprBits.HasTrailingSourceLoc &&
3247+
"Trailing source loc already set?");
3248+
assert(getStmtClass() == CallExprClass &&
3249+
"Calling setTrailingSourceLocs on a subclass of CallExpr");
3250+
static_assert(sizeof(CallExpr) <=
3251+
OffsetToTrailingObjects + sizeof(SourceLocation));
3252+
3253+
SourceLocation *Locs =
3254+
reinterpret_cast<SourceLocation *>(reinterpret_cast<char *>(this + 1));
3255+
new (Locs) SourceLocation(getBeginLoc());
3256+
CallExprBits.HasTrailingSourceLoc = true;
3257+
}
3258+
3259+
public:
31933260
/// Return true if this is a call to __assume() or __builtin_assume() with
31943261
/// a non-value-dependent constant parameter evaluating as false.
31953262
bool isBuiltinAssumeFalse(const ASTContext &Ctx) const;

0 commit comments

Comments
 (0)