Skip to content

Commit 7a8480b

Browse files
authored
Merge branch 'main' into fix-invalid-base-ice
2 parents 8ff63ba + 6d00c42 commit 7a8480b

File tree

155 files changed

+51174
-88170
lines changed

Some content is hidden

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

155 files changed

+51174
-88170
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ Bug Fixes to C++ Support
926926
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
927927
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
928928
- Fixed a crash when handling invalid member using-declaration in C++20+ mode. (#GH63254)
929+
- Fix name lookup in lambda appearing in the body of a requires expression. (#GH147650)
929930
- Fix a crash when trying to instantiate an ambiguous specialization. (#GH51866)
930931
- Improved handling of variables with ``consteval`` constructors, to
931932
consistently treat the initializer as manifestly constant-evaluated.

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,28 +489,28 @@ def BitfieldInfoAttr : CIR_Attr<"BitfieldInfo", "bitfield_info"> {
489489
is 4 bits wide, starts at offset 0, and is signed.
490490
}];
491491
let parameters = (ins "mlir::StringAttr":$name,
492-
"mlir::Type":$storageType,
492+
"mlir::Type":$storage_type,
493493
"uint64_t":$size,
494494
"uint64_t":$offset,
495-
"bool":$isSigned);
495+
"bool":$is_signed);
496496

497497
let assemblyFormat = [{`<` struct($name,
498-
$storageType,
498+
$storage_type,
499499
$size,
500500
$offset,
501-
$isSigned)
501+
$is_signed)
502502
`>`
503503
}];
504504

505505
let builders = [
506506
AttrBuilder<(ins "llvm::StringRef":$name,
507-
"mlir::Type":$storageType,
507+
"mlir::Type":$storage_type,
508508
"uint64_t":$size,
509509
"uint64_t":$offset,
510-
"bool":$isSigned
510+
"bool":$is_signed
511511
), [{
512-
return $_get($_ctxt, mlir::StringAttr::get($_ctxt, name), storageType,
513-
size, offset, isSigned);
512+
return $_get($_ctxt, mlir::StringAttr::get($_ctxt, name), storage_type,
513+
size, offset, is_signed);
514514
}]>
515515
];
516516
}

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,9 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD,
10881088
return;
10891089
}
10901090

1091+
while (DC->isRequiresExprBody())
1092+
DC = DC->getParent();
1093+
10911094
if (DC->isTranslationUnit() || isStdNamespace(DC)) {
10921095
// Check if we have a template.
10931096
const TemplateArgumentList *TemplateArgs = nullptr;

clang/lib/Sema/SemaLambda.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ Sema::createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info,
249249
unsigned LambdaDependencyKind,
250250
LambdaCaptureDefault CaptureDefault) {
251251
DeclContext *DC = CurContext;
252-
while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
253-
DC = DC->getParent();
254252

255253
bool IsGenericLambda =
256254
Info && getGenericLambdaTemplateParameterList(getCurLambda(), *this);

clang/test/CIR/CodeGen/bitfields.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef struct {
1313
} A;
1414

1515
// CIR-DAG: !rec_A = !cir.record<struct "A" packed padded {!s8i, !s8i, !s8i, !u16i, !cir.array<!u8i x 3>}>
16-
// CIR-DAG: #bfi_more_bits = #cir.bitfield_info<name = "more_bits", storageType = !u16i, size = 4, offset = 3, isSigned = false>
16+
// CIR-DAG: #bfi_more_bits = #cir.bitfield_info<name = "more_bits", storage_type = !u16i, size = 4, offset = 3, is_signed = false>
1717
// LLVM-DAG: %struct.A = type <{ i8, i8, i8, i16, [3 x i8] }>
1818
// OGCG-DAG: %struct.A = type <{ i8, i8, i8, i16, [3 x i8] }>
1919

@@ -35,7 +35,7 @@ typedef struct {
3535
int e : 15;
3636
unsigned f; // type other than int above, not a bitfield
3737
} S;
38-
// CIR-DAG: #bfi_c = #cir.bitfield_info<name = "c", storageType = !u64i, size = 17, offset = 32, isSigned = true>
38+
// CIR-DAG: #bfi_c = #cir.bitfield_info<name = "c", storage_type = !u64i, size = 17, offset = 32, is_signed = true>
3939
// CIR-DAG: !rec_S = !cir.record<struct "S" {!u64i, !u16i, !u32i}>
4040
// LLVM-DAG: %struct.S = type { i64, i16, i32 }
4141
// OGCG-DAG: %struct.S = type { i64, i16, i32 }

clang/test/CIR/CodeGen/bitfields.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef struct {
1414
unsigned f; // type other than int above, not a bitfield
1515
} S;
1616
// CIR-DAG: !rec_S = !cir.record<struct "S" {!u64i, !u16i, !u32i}>
17-
// CIR-DAG: #bfi_c = #cir.bitfield_info<name = "c", storageType = !u64i, size = 17, offset = 32, isSigned = true>
17+
// CIR-DAG: #bfi_c = #cir.bitfield_info<name = "c", storage_type = !u64i, size = 17, offset = 32, is_signed = true>
1818
// LLVM-DAG: %struct.S = type { i64, i16, i32 }
1919
// OGCG-DAG: %struct.S = type { i64, i16, i32 }
2020

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: cir-opt %s | FileCheck %s
2+
3+
!s32i = !cir.int<s, 32>
4+
!u32i = !cir.int<u, 32>
5+
6+
7+
!rec_S = !cir.record<struct "S" {!u32i}>
8+
#bfi_c = #cir.bitfield_info<name = "c", storage_type = !u32i, size = 17, offset = 15, is_signed = true>
9+
10+
// CHECK: #bfi_c = #cir.bitfield_info<name = "c", storage_type = !u32i, size = 17, offset = 15, is_signed = true>
11+
12+
// Use bitfield to enforce printing the attribute
13+
cir.func dso_local @init(%arg0: !cir.ptr<!rec_S> ){
14+
%0 = cir.alloca !cir.ptr<!rec_S>, !cir.ptr<!cir.ptr<!rec_S>>, ["s", init] {alignment = 8 : i64}
15+
cir.store %arg0, %0 : !cir.ptr<!rec_S>, !cir.ptr<!cir.ptr<!rec_S>>
16+
%1 = cir.load align(8) %0 : !cir.ptr<!cir.ptr<!rec_S>>, !cir.ptr<!rec_S>
17+
%2 = cir.get_member %1[0] {name = "c"} : !cir.ptr<!rec_S> -> !cir.ptr<!u32i>
18+
%3 = cir.get_bitfield(#bfi_c, %2 : !cir.ptr<!u32i>) -> !s32i
19+
cir.return
20+
}

clang/test/CodeGenCXX/mangle-requires.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ template <typename T> void g(int n) requires requires (T m) {
3232
} {}
3333
// CHECK: define {{.*}}@_Z1gIiEviQrQT__XplfL0p_fp_E(
3434
template void g<int>(int);
35+
36+
37+
namespace GH147650 {
38+
39+
template <int> int b;
40+
template <int b>
41+
void f()
42+
requires requires { [] { (void)b; }; } {}
43+
void test() {
44+
f<42>();
45+
}
46+
// CHECK-LABEL:define {{.*}} void @"_ZN8GH1476501fILi42EEEvvQrqXLNS_3$_0EEE"()
47+
}

clang/test/CodeGenCXX/ms-mangle-requires.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,15 @@ void m_fn2() {
5757
} // namespace Regression2
5858

5959
}
60+
61+
namespace GH147650 {
62+
63+
template <int> int b;
64+
template <int b>
65+
void f()
66+
requires requires { [] { (void)b; }; } {}
67+
void test() {
68+
f<42>();
69+
}
70+
// CHECK-LABEL:define {{.*}} void @"??$f@$0CK@@GH147650@@YAXXZ"()
71+
}

clang/test/SemaTemplate/concepts-lambda.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,13 @@ void foo() {
340340
}
341341

342342
}
343+
344+
namespace GH147650 {
345+
template <int> int b;
346+
template <int b>
347+
void f()
348+
requires requires { [] { (void)b; static_assert(b == 42); }; } {}
349+
void test() {
350+
f<42>();
351+
}
352+
}

0 commit comments

Comments
 (0)