Skip to content

Commit a2c59fb

Browse files
committed
Merge from 'main' to 'sycl-web' (37 commits)
CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp
2 parents efeef5d + 56ba118 commit a2c59fb

File tree

122 files changed

+2431
-1555
lines changed

Some content is hidden

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

122 files changed

+2431
-1555
lines changed

.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/CodeGen/CGDecl.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,11 @@ namespace {
635635
llvm::Constant *CleanupFn;
636636
const CGFunctionInfo &FnInfo;
637637
const VarDecl &Var;
638+
const CleanupAttr *Attribute;
638639

639640
CallCleanupFunction(llvm::Constant *CleanupFn, const CGFunctionInfo *Info,
640-
const VarDecl *Var)
641-
: CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var) {}
641+
const VarDecl *Var, const CleanupAttr *Attr)
642+
: CleanupFn(CleanupFn), FnInfo(*Info), Var(*Var), Attribute(Attr) {}
642643

643644
void Emit(CodeGenFunction &CGF, Flags flags) override {
644645
DeclRefExpr DRE(CGF.getContext(), const_cast<VarDecl *>(&Var), false,
@@ -660,8 +661,11 @@ namespace {
660661
CallArgList Args;
661662
Args.add(RValue::get(Arg),
662663
CGF.getContext().getPointerType(Var.getType()));
663-
auto Callee = CGCallee::forDirect(CleanupFn);
664-
CGF.EmitCall(FnInfo, Callee, ReturnValueSlot(), Args);
664+
GlobalDecl GD = GlobalDecl(Attribute->getFunctionDecl());
665+
auto Callee = CGCallee::forDirect(CleanupFn, CGCalleeInfo(GD));
666+
CGF.EmitCall(FnInfo, Callee, ReturnValueSlot(), Args,
667+
/*callOrInvoke*/ nullptr, /*IsMustTail*/ false,
668+
Attribute->getLoc());
665669
}
666670
};
667671
} // end anonymous namespace
@@ -2289,7 +2293,8 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
22892293
assert(F && "Could not find function!");
22902294

22912295
const CGFunctionInfo &Info = CGM.getTypes().arrangeFunctionDeclaration(FD);
2292-
EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, F, &Info, &D);
2296+
EHStack.pushCleanup<CallCleanupFunction>(NormalAndEHCleanup, F, &Info, &D,
2297+
CA);
22932298
}
22942299

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

clang/lib/Headers/avxintrin.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ _mm256_set_ps(float __a, float __b, float __c, float __d,
37773777
/// \param __i7
37783778
/// A 32-bit integral value used to initialize bits [31:0] of the result.
37793779
/// \returns An initialized 256-bit integer vector.
3780-
static __inline __m256i __DEFAULT_FN_ATTRS
3780+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
37813781
_mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
37823782
int __i4, int __i5, int __i6, int __i7)
37833783
{
@@ -3825,7 +3825,7 @@ _mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
38253825
/// \param __w00
38263826
/// A 16-bit integral value used to initialize bits [15:0] of the result.
38273827
/// \returns An initialized 256-bit integer vector.
3828-
static __inline __m256i __DEFAULT_FN_ATTRS
3828+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
38293829
_mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
38303830
short __w11, short __w10, short __w09, short __w08,
38313831
short __w07, short __w06, short __w05, short __w04,
@@ -3908,7 +3908,7 @@ _mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
39083908
/// \param __b00
39093909
/// An 8-bit integral value used to initialize bits [7:0] of the result.
39103910
/// \returns An initialized 256-bit integer vector.
3911-
static __inline __m256i __DEFAULT_FN_ATTRS
3911+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
39123912
_mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
39133913
char __b27, char __b26, char __b25, char __b24,
39143914
char __b23, char __b22, char __b21, char __b20,
@@ -3943,7 +3943,7 @@ _mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
39433943
/// \param __d
39443944
/// A 64-bit integral value used to initialize bits [63:0] of the result.
39453945
/// \returns An initialized 256-bit integer vector.
3946-
static __inline __m256i __DEFAULT_FN_ATTRS
3946+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
39473947
_mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
39483948
{
39493949
return __extension__ (__m256i)(__v4di){ __d, __c, __b, __a };
@@ -4044,7 +4044,7 @@ _mm256_setr_ps(float __a, float __b, float __c, float __d,
40444044
/// \param __i7
40454045
/// A 32-bit integral value used to initialize bits [255:224] of the result.
40464046
/// \returns An initialized 256-bit integer vector.
4047-
static __inline __m256i __DEFAULT_FN_ATTRS
4047+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
40484048
_mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
40494049
int __i4, int __i5, int __i6, int __i7)
40504050
{
@@ -4092,7 +4092,7 @@ _mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
40924092
/// \param __w00
40934093
/// A 16-bit integral value used to initialize bits [255:240] of the result.
40944094
/// \returns An initialized 256-bit integer vector.
4095-
static __inline __m256i __DEFAULT_FN_ATTRS
4095+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
40964096
_mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
40974097
short __w11, short __w10, short __w09, short __w08,
40984098
short __w07, short __w06, short __w05, short __w04,
@@ -4177,7 +4177,7 @@ _mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
41774177
/// \param __b00
41784178
/// An 8-bit integral value used to initialize bits [255:248] of the result.
41794179
/// \returns An initialized 256-bit integer vector.
4180-
static __inline __m256i __DEFAULT_FN_ATTRS
4180+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
41814181
_mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
41824182
char __b27, char __b26, char __b25, char __b24,
41834183
char __b23, char __b22, char __b21, char __b20,
@@ -4210,7 +4210,7 @@ _mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
42104210
/// \param __d
42114211
/// A 64-bit integral value used to initialize bits [255:192] of the result.
42124212
/// \returns An initialized 256-bit integer vector.
4213-
static __inline __m256i __DEFAULT_FN_ATTRS
4213+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42144214
_mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
42154215
{
42164216
return _mm256_set_epi64x(__d, __c, __b, __a);
@@ -4267,7 +4267,7 @@ _mm256_set1_ps(float __w)
42674267
/// A 32-bit integral value used to initialize each vector element of the
42684268
/// result.
42694269
/// \returns An initialized 256-bit integer vector of [8 x i32].
4270-
static __inline __m256i __DEFAULT_FN_ATTRS
4270+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42714271
_mm256_set1_epi32(int __i)
42724272
{
42734273
return _mm256_set_epi32(__i, __i, __i, __i, __i, __i, __i, __i);
@@ -4285,7 +4285,7 @@ _mm256_set1_epi32(int __i)
42854285
/// A 16-bit integral value used to initialize each vector element of the
42864286
/// result.
42874287
/// \returns An initialized 256-bit integer vector of [16 x i16].
4288-
static __inline __m256i __DEFAULT_FN_ATTRS
4288+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
42894289
_mm256_set1_epi16(short __w)
42904290
{
42914291
return _mm256_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w,
@@ -4303,7 +4303,7 @@ _mm256_set1_epi16(short __w)
43034303
/// An 8-bit integral value used to initialize each vector element of the
43044304
/// result.
43054305
/// \returns An initialized 256-bit integer vector of [32 x i8].
4306-
static __inline __m256i __DEFAULT_FN_ATTRS
4306+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
43074307
_mm256_set1_epi8(char __b)
43084308
{
43094309
return _mm256_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b,
@@ -4324,7 +4324,7 @@ _mm256_set1_epi8(char __b)
43244324
/// A 64-bit integral value used to initialize each vector element of the
43254325
/// result.
43264326
/// \returns An initialized 256-bit integer vector of [4 x i64].
4327-
static __inline __m256i __DEFAULT_FN_ATTRS
4327+
static __inline __m256i __DEFAULT_FN_ATTRS_CONSTEXPR
43284328
_mm256_set1_epi64x(long long __q)
43294329
{
43304330
return _mm256_set_epi64x(__q, __q, __q, __q);

clang/lib/Sema/SemaModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,8 @@ bool ExposureChecker::isTULocal(const NamedDecl *D) {
12221222
// [basic.link]p15.5
12231223
// - a specialization of a template whose (possibly instantiated) declaration
12241224
// is an exposure.
1225-
if (checkExposure(PrimaryTemplate, /*Diag=*/false))
1225+
if (ExposureSet.count(PrimaryTemplate) ||
1226+
checkExposure(PrimaryTemplate, /*Diag=*/false))
12261227
return true;
12271228

12281229
// Avoid calling checkExposure again since it is expensive.

clang/test/AST/ByteCode/cxx11.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,15 @@ namespace PR19010 {
318318
};
319319
void test() { constexpr Test t; }
320320
}
321+
322+
namespace ReadMutableInCopyCtor {
323+
struct G {
324+
struct X {};
325+
union U { X a; };
326+
mutable U u; // both-note {{declared here}}
327+
};
328+
constexpr G g1 = {};
329+
constexpr G g2 = g1; // both-error {{must be initialized by a constant expression}} \
330+
// both-note {{read of mutable member 'u'}} \
331+
// both-note {{in call to 'G(g1)'}}
332+
}

clang/test/CodeGen/PowerPC/check-zero-vector.c

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)