Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 179d2f9

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d2b8acc10464 into amd-gfx:f8992209d7db
Local branch amd-gfx f899220 Merged main:8c0090030bf8 into amd-gfx:4088678579a3 Remote branch main d2b8acc [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (llvm#120649)
2 parents f899220 + d2b8acc commit 179d2f9

File tree

184 files changed

+2102
-2331
lines changed

Some content is hidden

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

184 files changed

+2102
-2331
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,6 @@ New Compiler Flags
445445
- The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison
446446
starting from C++26, this warning is enabled as an error by default.
447447

448-
- '-fsanitize-merge' (default) and '-fno-sanitize-merge' have been added for
449-
fine-grained control of which UBSan checks are allowed to be merged by the
450-
backend (for example, -fno-sanitize-merge=bool,enum).
451-
452448
Deprecated Compiler Flags
453449
-------------------------
454450

@@ -488,8 +484,6 @@ Removed Compiler Flags
488484
derivatives) is now removed, since it's no longer possible to suppress the
489485
diagnostic (see above). Users can expect an `unknown warning` diagnostic if
490486
it's still in use.
491-
- The experimental flag '-ubsan-unique-traps' has been removed. It is
492-
superseded by '-fno-sanitize-merge'.
493487

494488
Attribute Changes in Clang
495489
--------------------------
@@ -708,6 +702,9 @@ Improvements to Clang's diagnostics
708702
709703
- Fix -Wdangling false positives on conditional operators (#120206).
710704

705+
- Fixed a bug where Clang hung on an unsupported optional scope specifier ``::`` when parsing
706+
Objective-C. Clang now emits a diagnostic message instead of hanging.
707+
711708
Improvements to Clang's time-trace
712709
----------------------------------
713710

@@ -1210,6 +1207,11 @@ Sanitizers
12101207

12111208
- Implemented ``-f[no-]sanitize-trap=local-bounds``, and ``-f[no-]sanitize-recover=local-bounds``.
12121209

1210+
- ``-fsanitize-merge`` (default) and ``-fno-sanitize-merge`` have been added for
1211+
fine-grained, unified control of which UBSan checks can potentially be merged
1212+
by the compiler (for example,
1213+
``-fno-sanitize-merge=bool,enum,array-bounds,local-bounds``).
1214+
12131215
Python Binding Changes
12141216
----------------------
12151217
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.

clang/docs/UndefinedBehaviorSanitizer.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ Stack traces and report symbolization
276276
If you want UBSan to print symbolized stack trace for each error report, you
277277
will need to:
278278

279-
#. Compile with ``-g`` and ``-fno-omit-frame-pointer`` to get proper debug
280-
information in your binary.
279+
#. Compile with ``-g``, ``-fno-sanitize-merge`` and ``-fno-omit-frame-pointer``
280+
to get proper debug information in your binary.
281281
#. Run your program with environment variable
282282
``UBSAN_OPTIONS=print_stacktrace=1``.
283283
#. Make sure ``llvm-symbolizer`` binary is in ``PATH``.

clang/include/clang/AST/Stmt.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ class alignas(void *) Stmt {
114114
#define STMT(CLASS, PARENT)
115115
#define STMT_RANGE(BASE, FIRST, LAST)
116116
#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
117-
static_assert( \
118-
llvm::isInt<NumStmtBits>(StmtClass::LAST##Class), \
119-
"The number of 'StmtClass'es is strictly bounded under two to " \
120-
"the power of 'NumStmtBits'");
117+
static_assert(llvm::isUInt<NumStmtBits>(StmtClass::LAST##Class), \
118+
"The number of 'StmtClass'es is strictly bound " \
119+
"by a bitfield of width NumStmtBits");
121120
#define ABSTRACT_STMT(STMT)
122121
#include "clang/AST/StmtNodes.inc"
123122

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10301030
PB.registerScalarOptimizerLateEPCallback(
10311031
[this](FunctionPassManager &FPM, OptimizationLevel Level) {
10321032
BoundsCheckingPass::ReportingMode Mode;
1033+
bool Merge = CodeGenOpts.SanitizeMergeHandlers.has(
1034+
SanitizerKind::LocalBounds);
1035+
10331036
if (CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) {
10341037
Mode = BoundsCheckingPass::ReportingMode::Trap;
10351038
} else if (CodeGenOpts.SanitizeMinimalRuntime) {
@@ -1041,7 +1044,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10411044
? BoundsCheckingPass::ReportingMode::FullRuntime
10421045
: BoundsCheckingPass::ReportingMode::FullRuntimeAbort;
10431046
}
1044-
FPM.addPass(BoundsCheckingPass(Mode));
1047+
BoundsCheckingPass::BoundsCheckingOptions Options(Mode, Merge);
1048+
FPM.addPass(BoundsCheckingPass(Options));
10451049
});
10461050

10471051
// Don't add sanitizers if we are here from ThinLTO PostLink. That already

clang/lib/Parse/Parser.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,8 +2222,15 @@ bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(
22222222
}
22232223
}
22242224

2225-
if (SS.isEmpty())
2225+
if (SS.isEmpty()) {
2226+
if (getLangOpts().ObjC && !getLangOpts().CPlusPlus &&
2227+
Tok.is(tok::coloncolon)) {
2228+
// ObjectiveC does not allow :: as as a scope token.
2229+
Diag(ConsumeToken(), diag::err_expected_type);
2230+
return true;
2231+
}
22262232
return false;
2233+
}
22272234

22282235
// A C++ scope specifier that isn't followed by a typename.
22292236
AnnotateScopeToken(SS, IsNewScope);

clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ class UncountedLambdaCapturesChecker
155155
if (!Init)
156156
return nullptr;
157157
TempExpr = dyn_cast<CXXBindTemporaryExpr>(Init->IgnoreParenCasts());
158+
if (!TempExpr)
159+
return nullptr;
158160
return dyn_cast_or_null<LambdaExpr>(TempExpr->getSubExpr());
159161
}
160162

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -verify %s
2+
// expected-no-diagnostics
3+
4+
struct Foo {
5+
int x;
6+
int y;
7+
Foo(int x, int y) : x(x) , y(y) { }
8+
~Foo() { }
9+
};
10+
11+
Foo bar(const Foo&);
12+
void foo() {
13+
int x = 7;
14+
int y = 5;
15+
bar(Foo(x, y));
16+
}

clang/test/CodeGen/bounds-checking.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
2-
// RUN: %clang_cc1 -fsanitize=array-bounds -O -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s
1+
// N.B. The clang driver defaults to -fsanitize-merge but clang_cc1 effectively
2+
// defaults to -fno-sanitize-merge.
33
// RUN: %clang_cc1 -fsanitize=array-bounds -O -fsanitize-trap=array-bounds -emit-llvm -triple x86_64-apple-darwin10 -DNO_DYNAMIC %s -o - | FileCheck %s
4+
// RUN: %clang_cc1 -fsanitize=array-bounds -O -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s
45
//
5-
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -mllvm -bounds-checking-unique-traps -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL
6-
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTLOCAL
6+
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
7+
//
8+
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL
9+
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -fno-sanitize-merge -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL
10+
// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -fsanitize-merge=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTLOCAL
711
//
8-
// N.B. The clang driver defaults to -fsanitize-merge but clang_cc1 effectively
9-
// defaults to -fno-sanitize-merge.
1012
// RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTARRAY
1113
// RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -fno-sanitize-merge -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTARRAY
1214
// RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -fsanitize-merge=array-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTARRAY

clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
// CHECK-NEXT: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit
5959
// CHECK-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions
6060
// CHECK-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions
61+
// CHECK-NEXT: FEAT_SVE2p1 Enable Scalable Vector Extension 2.1 instructions
6162
// CHECK-NEXT: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions
6263
// CHECK-NEXT: FEAT_TRBE Enable Trace Buffer Extension
6364
// CHECK-NEXT: FEAT_TRF Enable Armv8.4-A Trace extension

clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
// CHECK-NEXT: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit
6262
// CHECK-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions
6363
// CHECK-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions
64+
// CHECK-NEXT: FEAT_SVE2p1 Enable Scalable Vector Extension 2.1 instructions
6465
// CHECK-NEXT: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions
6566
// CHECK-NEXT: FEAT_TRBE Enable Trace Buffer Extension
6667
// CHECK-NEXT: FEAT_TRF Enable Armv8.4-A Trace extension

0 commit comments

Comments
 (0)