Skip to content

Commit 8a11303

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:586986a063ee into amd-gfx:b8966b19ced0
Local branch amd-gfx b8966b1 Merged main:770dc47659d4 into amd-gfx:8ac93c272270 Remote branch main 586986a [Flang] Add multiline error message support to pass-plugin-not-found (NFC) (llvm#73601)
2 parents b8966b1 + 586986a commit 8a11303

File tree

21 files changed

+953
-66
lines changed

21 files changed

+953
-66
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,9 @@ Bug Fixes to C++ Support
790790
completes (except deduction guides). Fixes:
791791
(`#59827 <https://github.com/llvm/llvm-project/issues/59827>`_)
792792

793+
- Fix crash when parsing nested requirement. Fixes:
794+
(`#73112 <https://github.com/llvm/llvm-project/issues/73112>`_)
795+
793796
Bug Fixes to AST Handling
794797
^^^^^^^^^^^^^^^^^^^^^^^^^
795798
- Fixed an import failure of recursive friend class template.

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5756,6 +5756,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
57565756
if (CM == "large" && RelocationModel != llvm::Reloc::Static)
57575757
D.Diag(diag::err_drv_argument_only_allowed_with)
57585758
<< A->getAsString(Args) << "-fno-pic";
5759+
} else if (Triple.isLoongArch()) {
5760+
if (CM == "extreme" &&
5761+
Args.hasFlagNoClaim(options::OPT_fplt, options::OPT_fno_plt, false))
5762+
D.Diag(diag::err_drv_argument_not_allowed_with)
5763+
<< A->getAsString(Args) << "-fplt";
5764+
Ok = CM == "normal" || CM == "medium" || CM == "extreme";
5765+
// Convert to LLVM recognizable names.
5766+
if (Ok)
5767+
CM = llvm::StringSwitch<StringRef>(CM)
5768+
.Case("normal", "small")
5769+
.Case("extreme", "large")
5770+
.Default(CM);
57595771
} else if (Triple.isPPC64() || Triple.isOSAIX()) {
57605772
Ok = CM == "small" || CM == "medium" || CM == "large";
57615773
} else if (Triple.isRISCV()) {

clang/lib/Parse/ParseExprCXX.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,10 +3635,12 @@ ExprResult Parser::ParseRequiresExpression() {
36353635
auto Res = TryParseParameterDeclarationClause();
36363636
if (Res != TPResult::False) {
36373637
// Skip to the closing parenthesis
3638-
// FIXME: Don't traverse these tokens twice (here and in
3639-
// TryParseParameterDeclarationClause).
36403638
unsigned Depth = 1;
36413639
while (Depth != 0) {
3640+
bool FoundParen = SkipUntil(tok::l_paren, tok::r_paren,
3641+
SkipUntilFlags::StopBeforeMatch);
3642+
if (!FoundParen)
3643+
break;
36423644
if (Tok.is(tok::l_paren))
36433645
Depth++;
36443646
else if (Tok.is(tok::r_paren))

clang/test/Driver/mcmodel.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
// RUN: not %clang -### -c --target=aarch64 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
1616
// RUN: not %clang -### -c --target=aarch64 -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
1717
// RUN: not %clang --target=aarch64_32-linux -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-AARCH64_32 %s
18+
// RUN: %clang --target=loongarch64 -### -S -mcmodel=normal %s 2>&1 | FileCheck --check-prefix=SMALL %s
19+
// RUN: %clang --target=loongarch64 -### -S -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
20+
// RUN: %clang --target=loongarch64 -### -S -mcmodel=extreme %s 2>&1 | FileCheck --check-prefix=LARGE %s
21+
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=ERR-TINY %s
22+
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-SMALL %s
23+
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
24+
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=ERR-LARGE %s
25+
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=extreme -fplt %s 2>&1 | FileCheck --check-prefix=ERR-LOONGARCH64-PLT-EXTREME %s
1826

1927
// TINY: "-mcmodel=tiny"
2028
// SMALL: "-mcmodel=small"
@@ -25,9 +33,14 @@
2533

2634
// INVALID: error: unsupported argument 'lager' to option '-mcmodel=' for target '{{.*}}'
2735

36+
// ERR-TINY: error: unsupported argument 'tiny' to option '-mcmodel=' for target '{{.*}}'
37+
// ERR-SMALL: error: unsupported argument 'small' to option '-mcmodel=' for target '{{.*}}'
2838
// ERR-MEDIUM: error: unsupported argument 'medium' to option '-mcmodel=' for target '{{.*}}'
2939
// ERR-KERNEL: error: unsupported argument 'kernel' to option '-mcmodel=' for target '{{.*}}'
3040
// ERR-LARGE: error: unsupported argument 'large' to option '-mcmodel=' for target '{{.*}}'
3141

3242
// AARCH64-PIC-LARGE: error: invalid argument '-mcmodel=large' only allowed with '-fno-pic'
3343
// ERR-AARCH64_32: error: unsupported argument 'small' to option '-mcmodel=' for target 'aarch64_32-unknown-linux'
44+
45+
// ERR-LOONGARCH64-PLT-LARGE: error: invalid argument '-mcmodel=large' not allowed with '-fplt'
46+
// ERR-LOONGARCH64-PLT-EXTREME: error: invalid argument '-mcmodel=extreme' not allowed with '-fplt'

clang/test/Parser/cxx2a-concepts-requires-expr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,11 @@ template <int N>
160160
requires requires {
161161
typename BitInt<N>; // ok
162162
} using r44 = void;
163+
164+
namespace GH73112 {
165+
void f() {
166+
requires { requires(int; } // expected-error {{expected ')'}} \
167+
// expected-error {{expected expression}} \
168+
// expected-note {{to match this '('}}
169+
}
170+
}

flang/lib/Semantics/check-directive-structure.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ template <typename D> class NoBranchingEnforce {
7979
break;
8080
}
8181
} else if constexpr (std::is_same_v<D, llvm::acc::Directive>) {
82-
return; // OpenACC construct do not need check for unlabelled CYCLES
82+
switch ((llvm::acc::Directive)currentDirective_) {
83+
// exclude loop directives which do not need a check for unlabelled
84+
// CYCLES
85+
case llvm::acc::Directive::ACCD_loop:
86+
case llvm::acc::Directive::ACCD_kernels_loop:
87+
case llvm::acc::Directive::ACCD_parallel_loop:
88+
case llvm::acc::Directive::ACCD_serial_loop:
89+
return;
90+
default:
91+
break;
92+
}
8393
}
8494
CheckConstructNameBranching("CYCLE");
8595
}

flang/test/Driver/pass-plugin-not-found.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
! RUN: not %flang_fc1 -emit-llvm -o /dev/null -fpass-plugin=X.Y %s 2>&1 | FileCheck %s --check-prefix=ERROR
77

88
! The exact wording of the error message depends on the system dlerror.
9-
! ERROR: error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': {{.*}}: {{.*}}{{[Nn]}}o such file{{.*}}'
9+
! ERROR: error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': {{.*}}{{[[:space:]].*}}{{.*}}: {{.*}}{{[Nn]}}o such file{{.*}}'

flang/test/Driver/underscoring.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ subroutine test()
2121
! NO-UNDERSCORING-NOT: ext_sub_
2222
! NO-UNDERSCORING: {{ext_sub[^_]*$}}
2323
! NO-UNDERSCORING-NOT: comblk_
24-
! NO-UNDERSCORING: comblk,
24+
! NO-UNDERSCORING: {{comblk[^_]*$}}

flang/test/Semantics/OpenACC/acc-data.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ program openacc_data_validity
187187
!$acc data copy(aa) device_type(default) wait
188188
!$acc end data
189189

190+
do i = 1, 100
191+
!$acc data copy(aa)
192+
!ERROR: CYCLE to construct outside of DATA construct is not allowed
193+
if (i == 10) cycle
194+
!$acc end data
195+
end do
196+
197+
!$acc data copy(aa)
198+
do i = 1, 100
199+
if (i == 10) cycle
200+
end do
201+
!$acc end data
202+
190203
end program openacc_data_validity
191204

192205
module mod1

flang/test/Semantics/OpenACC/acc-kernels.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,17 @@ program openacc_kernels_validity
144144
end do
145145
!$acc end kernels
146146

147+
do i = 1, 100
148+
!$acc kernels
149+
!ERROR: CYCLE to construct outside of KERNELS construct is not allowed
150+
if (i == 10) cycle
151+
!$acc end kernels
152+
end do
153+
154+
!$acc kernels
155+
do i = 1, 100
156+
if (i == 10) cycle
157+
end do
158+
!$acc end kernels
159+
147160
end program openacc_kernels_validity

flang/test/Semantics/OpenACC/acc-parallel.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,17 @@ program openacc_parallel_validity
142142
end do
143143
!$acc end parallel
144144

145+
do i = 1, 100
146+
!$acc parallel
147+
!ERROR: CYCLE to construct outside of PARALLEL construct is not allowed
148+
if (i == 10) cycle
149+
!$acc end parallel
150+
end do
151+
152+
!$acc parallel
153+
do i = 1, 100
154+
if (i == 10) cycle
155+
end do
156+
!$acc end parallel
157+
145158
end program openacc_parallel_validity

flang/test/Semantics/OpenACC/acc-serial.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,17 @@ program openacc_serial_validity
166166
end do
167167
!$acc end serial
168168

169+
do i = 1, 100
170+
!$acc serial
171+
!ERROR: CYCLE to construct outside of SERIAL construct is not allowed
172+
if (i == 10) cycle
173+
!$acc end serial
174+
end do
175+
176+
!$acc serial
177+
do i = 1, 100
178+
if (i == 10) cycle
179+
end do
180+
!$acc end serial
181+
169182
end program openacc_serial_validity

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,9 @@ ConvertDWARFCallingConventionToClang(const ParsedDWARFTypeAttributes &attrs) {
980980
return clang::CC_C;
981981
}
982982

983-
TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
984-
ParsedDWARFTypeAttributes &attrs) {
983+
TypeSP
984+
DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
985+
const ParsedDWARFTypeAttributes &attrs) {
985986
Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
986987

987988
SymbolFileDWARF *dwarf = die.GetDWARF();
@@ -1090,16 +1091,10 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
10901091
}
10911092

10921093
if (class_opaque_type) {
1093-
// If accessibility isn't set to anything valid, assume public
1094-
// for now...
1095-
if (attrs.accessibility == eAccessNone)
1096-
attrs.accessibility = eAccessPublic;
1097-
10981094
clang::ObjCMethodDecl *objc_method_decl =
10991095
m_ast.AddMethodToObjCObjectType(
11001096
class_opaque_type, attrs.name.GetCString(), clang_type,
1101-
attrs.accessibility, attrs.is_artificial, is_variadic,
1102-
attrs.is_objc_direct_call);
1097+
attrs.is_artificial, is_variadic, attrs.is_objc_direct_call);
11031098
type_handled = objc_method_decl != nullptr;
11041099
if (type_handled) {
11051100
LinkDeclContextToDIE(objc_method_decl, die);
@@ -1206,14 +1201,15 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
12061201
// Neither GCC 4.2 nor clang++ currently set a valid
12071202
// accessibility in the DWARF for C++ methods...
12081203
// Default to public for now...
1209-
if (attrs.accessibility == eAccessNone)
1210-
attrs.accessibility = eAccessPublic;
1204+
const auto accessibility = attrs.accessibility == eAccessNone
1205+
? eAccessPublic
1206+
: attrs.accessibility;
12111207

12121208
clang::CXXMethodDecl *cxx_method_decl =
12131209
m_ast.AddMethodToCXXRecordType(
12141210
class_opaque_type.GetOpaqueQualType(),
12151211
attrs.name.GetCString(), attrs.mangled_name,
1216-
clang_type, attrs.accessibility, attrs.is_virtual,
1212+
clang_type, accessibility, attrs.is_virtual,
12171213
is_static, attrs.is_inline, attrs.is_explicit,
12181214
is_attr_used, attrs.is_artificial);
12191215

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
368368
const lldb_private::plugin::dwarf::DWARFDIE &die,
369369
ParsedDWARFTypeAttributes &attrs);
370370
lldb::TypeSP ParseSubroutine(const lldb_private::plugin::dwarf::DWARFDIE &die,
371-
ParsedDWARFTypeAttributes &attrs);
371+
const ParsedDWARFTypeAttributes &attrs);
372372
lldb::TypeSP ParseArrayType(const lldb_private::plugin::dwarf::DWARFDIE &die,
373373
const ParsedDWARFTypeAttributes &attrs);
374374
lldb::TypeSP

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8110,8 +8110,8 @@ clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType(
81108110
const char *name, // the full symbol name as seen in the symbol table
81118111
// (lldb::opaque_compiler_type_t type, "-[NString
81128112
// stringWithCString:]")
8113-
const CompilerType &method_clang_type, lldb::AccessType access,
8114-
bool is_artificial, bool is_variadic, bool is_objc_direct_call) {
8113+
const CompilerType &method_clang_type, bool is_artificial, bool is_variadic,
8114+
bool is_objc_direct_call) {
81158115
if (!type || !method_clang_type.IsValid())
81168116
return nullptr;
81178117

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,8 @@ class TypeSystemClang : public TypeSystem {
985985
const char *name, // the full symbol name as seen in the symbol table
986986
// (lldb::opaque_compiler_type_t type, "-[NString
987987
// stringWithCString:]")
988-
const CompilerType &method_compiler_type, lldb::AccessType access,
989-
bool is_artificial, bool is_variadic, bool is_objc_direct_call);
988+
const CompilerType &method_compiler_type, bool is_artificial,
989+
bool is_variadic, bool is_objc_direct_call);
990990

991991
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
992992
bool has_extern);

lldb/unittests/Symbol/TestTypeSystemClang.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,7 @@ TEST_F(TestTypeSystemClang, AddMethodToObjCObjectType) {
941941
bool artificial = false;
942942
bool objc_direct = false;
943943
clang::ObjCMethodDecl *method = TypeSystemClang::AddMethodToObjCObjectType(
944-
c, "-[A foo]", func_type, lldb::eAccessPublic, artificial, variadic,
945-
objc_direct);
944+
c, "-[A foo]", func_type, artificial, variadic, objc_direct);
946945
ASSERT_NE(method, nullptr);
947946

948947
// The interface decl should still have external lexical storage.

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 482212
19+
#define LLVM_MAIN_REVISION 482223
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

0 commit comments

Comments
 (0)