Skip to content

Commit 06b9397

Browse files
authored
Merge branch 'main' into cir-binassign
2 parents 01786b5 + 3ad2cd5 commit 06b9397

File tree

90 files changed

+1255
-1306
lines changed

Some content is hidden

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

90 files changed

+1255
-1306
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ C23 Feature Support
170170
scope.
171171
- Fixed a bug where you could not cast a null pointer constant to type
172172
``nullptr_t``. Fixes #GH133644.
173+
- Fixed a failed assertion with an invalid parameter to the ``#embed``
174+
directive. Fixes #GH126940.
173175

174176
C11 Feature Support
175177
^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,6 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty,
25112511
case Type::PackIndexing:
25122512
case Type::TemplateTypeParm:
25132513
case Type::UnaryTransform:
2514-
case Type::SubstTemplateTypeParm:
25152514
unresolvedType:
25162515
// Some callers want a prefix before the mangled type.
25172516
Out << Prefix;
@@ -2524,6 +2523,16 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty,
25242523
// so we return directly.
25252524
return true;
25262525

2526+
case Type::SubstTemplateTypeParm: {
2527+
auto *ST = cast<SubstTemplateTypeParmType>(Ty);
2528+
// If this was replaced from a type alias, this is not substituted
2529+
// from an outer template parameter, so it's not an unresolved-type.
2530+
if (auto *TD = dyn_cast<TemplateDecl>(ST->getAssociatedDecl());
2531+
TD && TD->isTypeAlias())
2532+
return mangleUnresolvedTypeOrSimpleId(ST->getReplacementType(), Prefix);
2533+
goto unresolvedType;
2534+
}
2535+
25272536
case Type::Typedef:
25282537
mangleSourceNameWithAbiTags(cast<TypedefType>(Ty)->getDecl());
25292538
break;

clang/lib/Lex/PPDirectives.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3897,7 +3897,9 @@ Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
38973897
return std::nullopt;
38983898
}
38993899
if (!ForHasEmbed) {
3900-
Diag(CurTok, diag::err_pp_unknown_parameter) << 1 << Parameter;
3900+
Diag(ParamStartLoc, diag::err_pp_unknown_parameter) << 1 << Parameter;
3901+
if (CurTok.isNot(tok::eod))
3902+
DiscardUntilEndOfDirective(CurTok);
39013903
return std::nullopt;
39023904
}
39033905
}

clang/test/CodeGenCXX/mangle.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,3 +1220,30 @@ namespace test61 {
12201220
// CHECK-LABEL: @_ZN6test611fINS_1XEEEvNT_1Y1aENS3_1bE
12211221
template void f<X>(int, int);
12221222
}
1223+
1224+
namespace test62 {
1225+
template <class> struct integral_constant {
1226+
static const int value = true;
1227+
};
1228+
template <int> struct _OrImpl {};
1229+
template <class _Args> using _Or = _OrImpl<_Args::value>;
1230+
template <class _Up>
1231+
void f(_Or<integral_constant<_Up>>) {}
1232+
// CHECK-LABEL: @_ZN6test621fIiEEvNS_7_OrImplIXsr17integral_constantIT_EE5valueEEE
1233+
template void f<int>(_OrImpl<1>);
1234+
} // namespace test62
1235+
1236+
namespace test63 {
1237+
namespace {
1238+
template <class, class> struct integral_constant {
1239+
static const int value = true;
1240+
};
1241+
template <class, class> struct _And {};
1242+
template <int> struct _OrImpl {};
1243+
template <class _First> using _Or = _OrImpl<_First::value>;
1244+
template <class _Up>
1245+
void f(_And<integral_constant<int, void>, _Or<integral_constant<_Up, int>>>);
1246+
} // namespace
1247+
// CHECK-LABEL: @_ZN6test6312_GLOBAL__N_11fIiEEvNS0_4_AndINS0_17integral_constantIivEENS0_7_OrImplIXsr17integral_constantIT_iEE5valueEEEEE
1248+
void g() { f<int>({}); }
1249+
} // namespace test63
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2+
// REQUIRES: amdgpu-registered-target
3+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx90a -emit-llvm -o - %s | FileCheck %s
4+
5+
// CHECK-LABEL: @test_amdgcn_raw_ptr_buffer_load_lds(
6+
// CHECK-NEXT: entry:
7+
// CHECK-NEXT: tail call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) [[RSRC:%.*]], ptr addrspace(3) [[LDS:%.*]], i32 1, i32 [[OFFSET:%.*]], i32 [[SOFFSET:%.*]], i32 2, i32 3)
8+
// CHECK-NEXT: ret void
9+
//
10+
void test_amdgcn_raw_ptr_buffer_load_lds(__amdgpu_buffer_rsrc_t rsrc, __local void * lds, int offset, int soffset) {
11+
__builtin_amdgcn_raw_ptr_buffer_load_lds(rsrc, lds, 1, offset, soffset, 2, 3);
12+
}

clang/test/CodeGenOpenCL/builtins-amdgcn-raw-buffer-load.cl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,3 @@ v3u32 test_amdgcn_raw_ptr_buffer_load_b96_non_const_soffset(__amdgpu_buffer_rsrc
170170
v4u32 test_amdgcn_raw_ptr_buffer_load_b128_non_const_soffset(__amdgpu_buffer_rsrc_t rsrc, int offset, int soffset) {
171171
return __builtin_amdgcn_raw_buffer_load_b128(rsrc, /*offset=*/0, soffset, /*aux=*/0);
172172
}
173-
174-
// CHECK-LABEL: @test_amdgcn_raw_ptr_buffer_load_lds(
175-
// CHECK-NEXT: entry:
176-
// CHECK-NEXT: tail call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) [[RSRC:%.*]], ptr addrspace(3) [[LDS:%.*]], i32 1, i32 [[OFFSET:%.*]], i32 [[SOFFSET:%.*]], i32 2, i32 3)
177-
// CHECK-NEXT: ret void
178-
//
179-
void test_amdgcn_raw_ptr_buffer_load_lds(__amdgpu_buffer_rsrc_t rsrc, __local void * lds, int offset, int soffset) {
180-
__builtin_amdgcn_raw_ptr_buffer_load_lds(rsrc, lds, 1, offset, soffset, 2, 3);
181-
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
// RUN: %clang_cc1 %s -std=c23 -E -verify
2-
// okay-no-diagnostics
32

43
#embed __FILE__ unrecognized
54
// expected-error@-1 {{unknown embed preprocessor parameter 'unrecognized'}}
65
#embed __FILE__ unrecognized::param
76
// expected-error@-1 {{unknown embed preprocessor parameter 'unrecognized::param'}}
87
#embed __FILE__ unrecognized::param(with, args)
98
// expected-error@-1 {{unknown embed preprocessor parameter 'unrecognized::param'}}
9+
10+
// The first of these two cases was causing a failed assertion due to not being
11+
// at the end of the directive when we finished skipping past `bla`.
12+
#embed __FILE__ bla(2) limit(2) // expected-error {{unknown embed preprocessor parameter 'bla'}}
13+
#embed __FILE__ limit(2) bla(2) // expected-error {{unknown embed preprocessor parameter 'bla'}}
14+
15+
// We intentionally only tell you about one invalid parameter at a time so that
16+
// we can skip over invalid token soup.
17+
#embed __FILE__ bla(2) limit(2) bork // expected-error {{unknown embed preprocessor parameter 'bla'}}

clang/test/SemaOpenCL/builtins-amdgcn-raw-ptr-buffer-load-lds-target-error.cl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu tahiti -S -verify -o - %s
2+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu bonaire -S -verify -o - %s
3+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu carrizo -S -verify -o - %s
14
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1100 -S -verify -o - %s
5+
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1200 -S -verify -o - %s
26
// REQUIRES: amdgpu-registered-target
37

48
void test_amdgcn_raw_ptr_buffer_load_lds(__amdgpu_buffer_rsrc_t rsrc, __local void* lds, int offset, int soffset, int x) {

compiler-rt/test/asan/TestCases/use-after-poison-history-size-partial-granule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %clangxx_asan -O0 %s -o %t && env ASAN_OPTIONS=poison_history_size=1000 not %run %t 2>&1 | FileCheck %s
77

88
// TODO
9+
// REQUIRES: linux
910
// UNSUPPORTED: android
1011

1112
#include <stdio.h>

compiler-rt/test/asan/TestCases/use-after-poison-history-size.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// RUN: %clangxx_asan -O0 %s -o %t && env ASAN_OPTIONS=poison_history_size=1 not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK-ACDE,CHECK-BDE,CHECK-E
1818

1919
// TODO
20+
// REQUIRES: linux
2021
// UNSUPPORTED: android
2122

2223
#include <stdio.h>

0 commit comments

Comments
 (0)