Skip to content

Commit

Permalink
Merged main:586986a063ee into amd-gfx:b8966b19ced0
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
SC llvm team authored and SC llvm team committed Nov 30, 2023
2 parents b8966b1 + 586986a commit 8a11303
Show file tree
Hide file tree
Showing 21 changed files with 953 additions and 66 deletions.
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,9 @@ Bug Fixes to C++ Support
completes (except deduction guides). Fixes:
(`#59827 <https://github.com/llvm/llvm-project/issues/59827>`_)

- Fix crash when parsing nested requirement. Fixes:
(`#73112 <https://github.com/llvm/llvm-project/issues/73112>`_)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
- Fixed an import failure of recursive friend class template.
Expand Down
12 changes: 12 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5756,6 +5756,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (CM == "large" && RelocationModel != llvm::Reloc::Static)
D.Diag(diag::err_drv_argument_only_allowed_with)
<< A->getAsString(Args) << "-fno-pic";
} else if (Triple.isLoongArch()) {
if (CM == "extreme" &&
Args.hasFlagNoClaim(options::OPT_fplt, options::OPT_fno_plt, false))
D.Diag(diag::err_drv_argument_not_allowed_with)
<< A->getAsString(Args) << "-fplt";
Ok = CM == "normal" || CM == "medium" || CM == "extreme";
// Convert to LLVM recognizable names.
if (Ok)
CM = llvm::StringSwitch<StringRef>(CM)
.Case("normal", "small")
.Case("extreme", "large")
.Default(CM);
} else if (Triple.isPPC64() || Triple.isOSAIX()) {
Ok = CM == "small" || CM == "medium" || CM == "large";
} else if (Triple.isRISCV()) {
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/Parse/ParseExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3635,10 +3635,12 @@ ExprResult Parser::ParseRequiresExpression() {
auto Res = TryParseParameterDeclarationClause();
if (Res != TPResult::False) {
// Skip to the closing parenthesis
// FIXME: Don't traverse these tokens twice (here and in
// TryParseParameterDeclarationClause).
unsigned Depth = 1;
while (Depth != 0) {
bool FoundParen = SkipUntil(tok::l_paren, tok::r_paren,
SkipUntilFlags::StopBeforeMatch);
if (!FoundParen)
break;
if (Tok.is(tok::l_paren))
Depth++;
else if (Tok.is(tok::r_paren))
Expand Down
13 changes: 13 additions & 0 deletions clang/test/Driver/mcmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
// RUN: not %clang -### -c --target=aarch64 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
// RUN: not %clang -### -c --target=aarch64 -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
// RUN: not %clang --target=aarch64_32-linux -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-AARCH64_32 %s
// RUN: %clang --target=loongarch64 -### -S -mcmodel=normal %s 2>&1 | FileCheck --check-prefix=SMALL %s
// RUN: %clang --target=loongarch64 -### -S -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
// RUN: %clang --target=loongarch64 -### -S -mcmodel=extreme %s 2>&1 | FileCheck --check-prefix=LARGE %s
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=ERR-TINY %s
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-SMALL %s
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=ERR-LARGE %s
// RUN: not %clang --target=loongarch64 -### -S -mcmodel=extreme -fplt %s 2>&1 | FileCheck --check-prefix=ERR-LOONGARCH64-PLT-EXTREME %s

// TINY: "-mcmodel=tiny"
// SMALL: "-mcmodel=small"
Expand All @@ -25,9 +33,14 @@

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

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

// AARCH64-PIC-LARGE: error: invalid argument '-mcmodel=large' only allowed with '-fno-pic'
// ERR-AARCH64_32: error: unsupported argument 'small' to option '-mcmodel=' for target 'aarch64_32-unknown-linux'

// ERR-LOONGARCH64-PLT-LARGE: error: invalid argument '-mcmodel=large' not allowed with '-fplt'
// ERR-LOONGARCH64-PLT-EXTREME: error: invalid argument '-mcmodel=extreme' not allowed with '-fplt'
8 changes: 8 additions & 0 deletions clang/test/Parser/cxx2a-concepts-requires-expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,11 @@ template <int N>
requires requires {
typename BitInt<N>; // ok
} using r44 = void;

namespace GH73112 {
void f() {
requires { requires(int; } // expected-error {{expected ')'}} \
// expected-error {{expected expression}} \
// expected-note {{to match this '('}}
}
}
12 changes: 11 additions & 1 deletion flang/lib/Semantics/check-directive-structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ template <typename D> class NoBranchingEnforce {
break;
}
} else if constexpr (std::is_same_v<D, llvm::acc::Directive>) {
return; // OpenACC construct do not need check for unlabelled CYCLES
switch ((llvm::acc::Directive)currentDirective_) {
// exclude loop directives which do not need a check for unlabelled
// CYCLES
case llvm::acc::Directive::ACCD_loop:
case llvm::acc::Directive::ACCD_kernels_loop:
case llvm::acc::Directive::ACCD_parallel_loop:
case llvm::acc::Directive::ACCD_serial_loop:
return;
default:
break;
}
}
CheckConstructNameBranching("CYCLE");
}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/pass-plugin-not-found.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
! RUN: not %flang_fc1 -emit-llvm -o /dev/null -fpass-plugin=X.Y %s 2>&1 | FileCheck %s --check-prefix=ERROR

! The exact wording of the error message depends on the system dlerror.
! ERROR: error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': {{.*}}: {{.*}}{{[Nn]}}o such file{{.*}}'
! ERROR: error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': {{.*}}{{[[:space:]].*}}{{.*}}: {{.*}}{{[Nn]}}o such file{{.*}}'
2 changes: 1 addition & 1 deletion flang/test/Driver/underscoring.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ subroutine test()
! NO-UNDERSCORING-NOT: ext_sub_
! NO-UNDERSCORING: {{ext_sub[^_]*$}}
! NO-UNDERSCORING-NOT: comblk_
! NO-UNDERSCORING: comblk,
! NO-UNDERSCORING: {{comblk[^_]*$}}
13 changes: 13 additions & 0 deletions flang/test/Semantics/OpenACC/acc-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ program openacc_data_validity
!$acc data copy(aa) device_type(default) wait
!$acc end data

do i = 1, 100
!$acc data copy(aa)
!ERROR: CYCLE to construct outside of DATA construct is not allowed
if (i == 10) cycle
!$acc end data
end do

!$acc data copy(aa)
do i = 1, 100
if (i == 10) cycle
end do
!$acc end data

end program openacc_data_validity

module mod1
Expand Down
13 changes: 13 additions & 0 deletions flang/test/Semantics/OpenACC/acc-kernels.f90
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,17 @@ program openacc_kernels_validity
end do
!$acc end kernels

do i = 1, 100
!$acc kernels
!ERROR: CYCLE to construct outside of KERNELS construct is not allowed
if (i == 10) cycle
!$acc end kernels
end do

!$acc kernels
do i = 1, 100
if (i == 10) cycle
end do
!$acc end kernels

end program openacc_kernels_validity
13 changes: 13 additions & 0 deletions flang/test/Semantics/OpenACC/acc-parallel.f90
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,17 @@ program openacc_parallel_validity
end do
!$acc end parallel

do i = 1, 100
!$acc parallel
!ERROR: CYCLE to construct outside of PARALLEL construct is not allowed
if (i == 10) cycle
!$acc end parallel
end do

!$acc parallel
do i = 1, 100
if (i == 10) cycle
end do
!$acc end parallel

end program openacc_parallel_validity
13 changes: 13 additions & 0 deletions flang/test/Semantics/OpenACC/acc-serial.f90
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,17 @@ program openacc_serial_validity
end do
!$acc end serial

do i = 1, 100
!$acc serial
!ERROR: CYCLE to construct outside of SERIAL construct is not allowed
if (i == 10) cycle
!$acc end serial
end do

!$acc serial
do i = 1, 100
if (i == 10) cycle
end do
!$acc end serial

end program openacc_serial_validity
20 changes: 8 additions & 12 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,9 @@ ConvertDWARFCallingConventionToClang(const ParsedDWARFTypeAttributes &attrs) {
return clang::CC_C;
}

TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
ParsedDWARFTypeAttributes &attrs) {
TypeSP
DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
const ParsedDWARFTypeAttributes &attrs) {
Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);

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

if (class_opaque_type) {
// If accessibility isn't set to anything valid, assume public
// for now...
if (attrs.accessibility == eAccessNone)
attrs.accessibility = eAccessPublic;

clang::ObjCMethodDecl *objc_method_decl =
m_ast.AddMethodToObjCObjectType(
class_opaque_type, attrs.name.GetCString(), clang_type,
attrs.accessibility, attrs.is_artificial, is_variadic,
attrs.is_objc_direct_call);
attrs.is_artificial, is_variadic, attrs.is_objc_direct_call);
type_handled = objc_method_decl != nullptr;
if (type_handled) {
LinkDeclContextToDIE(objc_method_decl, die);
Expand Down Expand Up @@ -1206,14 +1201,15 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
// Neither GCC 4.2 nor clang++ currently set a valid
// accessibility in the DWARF for C++ methods...
// Default to public for now...
if (attrs.accessibility == eAccessNone)
attrs.accessibility = eAccessPublic;
const auto accessibility = attrs.accessibility == eAccessNone
? eAccessPublic
: attrs.accessibility;

clang::CXXMethodDecl *cxx_method_decl =
m_ast.AddMethodToCXXRecordType(
class_opaque_type.GetOpaqueQualType(),
attrs.name.GetCString(), attrs.mangled_name,
clang_type, attrs.accessibility, attrs.is_virtual,
clang_type, accessibility, attrs.is_virtual,
is_static, attrs.is_inline, attrs.is_explicit,
is_attr_used, attrs.is_artificial);

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
const lldb_private::plugin::dwarf::DWARFDIE &die,
ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP ParseSubroutine(const lldb_private::plugin::dwarf::DWARFDIE &die,
ParsedDWARFTypeAttributes &attrs);
const ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP ParseArrayType(const lldb_private::plugin::dwarf::DWARFDIE &die,
const ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8110,8 +8110,8 @@ clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType(
const char *name, // the full symbol name as seen in the symbol table
// (lldb::opaque_compiler_type_t type, "-[NString
// stringWithCString:]")
const CompilerType &method_clang_type, lldb::AccessType access,
bool is_artificial, bool is_variadic, bool is_objc_direct_call) {
const CompilerType &method_clang_type, bool is_artificial, bool is_variadic,
bool is_objc_direct_call) {
if (!type || !method_clang_type.IsValid())
return nullptr;

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,8 @@ class TypeSystemClang : public TypeSystem {
const char *name, // the full symbol name as seen in the symbol table
// (lldb::opaque_compiler_type_t type, "-[NString
// stringWithCString:]")
const CompilerType &method_compiler_type, lldb::AccessType access,
bool is_artificial, bool is_variadic, bool is_objc_direct_call);
const CompilerType &method_compiler_type, bool is_artificial,
bool is_variadic, bool is_objc_direct_call);

static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
bool has_extern);
Expand Down
3 changes: 1 addition & 2 deletions lldb/unittests/Symbol/TestTypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@ TEST_F(TestTypeSystemClang, AddMethodToObjCObjectType) {
bool artificial = false;
bool objc_direct = false;
clang::ObjCMethodDecl *method = TypeSystemClang::AddMethodToObjCObjectType(
c, "-[A foo]", func_type, lldb::eAccessPublic, artificial, variadic,
objc_direct);
c, "-[A foo]", func_type, artificial, variadic, objc_direct);
ASSERT_NE(method, nullptr);

// The interface decl should still have external lexical storage.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

/* Define if LLVM_ENABLE_DUMP is enabled */
#cmakedefine LLVM_ENABLE_DUMP
Expand Down
Loading

0 comments on commit 8a11303

Please sign in to comment.