Skip to content

Commit fccbf21

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2280)
2 parents bafa9b3 + 6542774 commit fccbf21

File tree

44 files changed

+469
-97
lines changed

Some content is hidden

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

44 files changed

+469
-97
lines changed

bolt/test/AArch64/check-init-not-moved.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# address. Test checks that _init is not moved.
66

77
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
8-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--section-start=.data=0x1000 -Wl,--section-start=.init=0x1004
8+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--image-base=0,-Tdata=0x1000,--section-start=.init=0x1004
99
# RUN: llvm-bolt %t.exe -o %t.bolt
1010
# RUN: llvm-nm %t.exe | FileCheck --check-prefix=CHECK-ORIGINAL %s
1111
# RUN: llvm-nm %t.bolt | FileCheck --check-prefix=CHECK-BOLTED %s

bolt/test/AArch64/pad-before-funcs.s

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

99

1010
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
11-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--section-start=.text=0x4000
11+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--image-base=0x3000,--section-start=.text=0x4000
1212
# RUN: llvm-bolt %t.exe -o %t.bolt.0 --pad-funcs-before=_start:0
1313
# RUN: llvm-bolt %t.exe -o %t.bolt.4 --pad-funcs-before=_start:4
1414
# RUN: llvm-bolt %t.exe -o %t.bolt.8 --pad-funcs-before=_start:8

bolt/test/RISCV/reloc-jt.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// NOTE: assign section addresses explicitly to make the symbol difference
22
/// calculation below less fragile.
3-
// RUN: %clang %cflags -Wl,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
3+
// RUN: %clang %cflags -Wl,--image-base=0,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
44
// RUN: llvm-bolt -o %t.bolt %t
55
// RUN: llvm-readelf -x .data %t.bolt | FileCheck %s
66

bolt/test/X86/double-rel-scan.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# REQUIRES: system-linux
77

88
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
9-
# RUN: ld.lld %t.o -o %t.exe -q --Ttext=0x80000
9+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x80000 --Ttext=0x80000
1010
# RUN: llvm-bolt %t.exe --relocs -o %t.bolt --funcs=foo
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \
1212
# RUN: | FileCheck %s

bolt/test/X86/double-rel.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# REQUIRES: system-linux
66

77
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
8-
# RUN: ld.lld %t.o -o %t.exe -q --Tdata=0x80000
8+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x70000 --Tdata=0x80000
99
# RUN: llvm-bolt %t.exe --relocs -o %t.null --print-only=_start --print-disasm \
1010
# RUN: | FileCheck %s --check-prefix=CHECK-BOLT
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ Bug Fixes to C++ Support
719719
certain differences in qualifiers (this could happen during template argument
720720
deduction or when building a ternary operator). (#GH97005)
721721
- Fixed type alias CTAD issues involving default template arguments. (#GH134471)
722+
- Fixed CTAD issues when initializing anonymous fields with designated initializers. (#GH67173)
722723
- The initialization kind of elements of structured bindings
723724
direct-list-initialized from an array is corrected to direct-initialization.
724725
- Clang no longer crashes when a coroutine is declared ``[[noreturn]]``. (#GH127327)

clang/lib/Format/Format.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3808,8 +3808,10 @@ reformat(const FormatStyle &Style, StringRef Code,
38083808
tooling::Replacements Replaces =
38093809
Formatter(*Env, Style, Status).process().first;
38103810
// add a replacement to remove the "x = " from the result.
3811-
Replaces = Replaces.merge(
3812-
tooling::Replacements(tooling::Replacement(FileName, 0, 4, "")));
3811+
if (Code.starts_with("x = ")) {
3812+
Replaces = Replaces.merge(
3813+
tooling::Replacements(tooling::Replacement(FileName, 0, 4, "")));
3814+
}
38133815
// apply the reformatting changes and the removal of "x = ".
38143816
if (applyAllReplacements(Code, Replaces))
38153817
return {Replaces, 0};

clang/lib/Sema/SemaInit.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,16 +2791,20 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
27912791
// initializer list that the child calls see, so that we don't try
27922792
// to re-process the designator.
27932793
unsigned OldIndex = Index;
2794-
IList->setInit(OldIndex, DIE->getInit());
2794+
auto *OldDIE =
2795+
dyn_cast_if_present<DesignatedInitExpr>(IList->getInit(OldIndex));
2796+
if (!OldDIE)
2797+
OldDIE = DIE;
2798+
IList->setInit(OldIndex, OldDIE->getInit());
27952799

27962800
CheckSubElementType(Entity, IList, CurrentObjectType, Index, StructuredList,
27972801
StructuredIndex, /*DirectlyDesignated=*/true);
27982802

27992803
// Restore the designated initializer expression in the syntactic
28002804
// form of the initializer list.
2801-
if (IList->getInit(OldIndex) != DIE->getInit())
2802-
DIE->setInit(IList->getInit(OldIndex));
2803-
IList->setInit(OldIndex, DIE);
2805+
if (IList->getInit(OldIndex) != OldDIE->getInit())
2806+
OldDIE->setInit(IList->getInit(OldIndex));
2807+
IList->setInit(OldIndex, OldDIE);
28042808

28052809
return hadError && !prevHadError;
28062810
}

clang/test/SemaTemplate/deduction-guide.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,3 +886,30 @@ CC c{};
886886
// CHECK-NEXT: `-ClassTemplateSpecialization {{.+}} 'A'
887887

888888
}
889+
890+
namespace GH67173 {
891+
892+
template <class T> struct Vec2d {
893+
struct {
894+
T x;
895+
T y;
896+
};
897+
};
898+
899+
void f() {
900+
Vec2d v{.x = 1, .y = 2};
901+
}
902+
903+
// CHECK-LABEL: Dumping GH67173::<deduction guide for Vec2d>:
904+
// CHECK-NEXT: FunctionTemplateDecl {{.+}} implicit <deduction guide for Vec2d>
905+
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} referenced class depth 0 index 0 T
906+
// CHECK: |-CXXDeductionGuideDecl {{.+}} implicit <deduction guide for Vec2d> 'auto (T, T) -> Vec2d<T>' aggregate
907+
// CHECK-NEXT: | |-ParmVarDecl {{.+}} col:27 'T'
908+
// CHECK-NEXT: | `-ParmVarDecl {{.+}} col:27 'T'
909+
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} implicit used <deduction guide for Vec2d> 'auto (int, int) -> GH67173::Vec2d<int>' implicit_instantiation aggregate
910+
// CHECK-NEXT: |-TemplateArgument type 'int'
911+
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
912+
// CHECK-NEXT: |-ParmVarDecl {{.+}} 'int'
913+
// CHECK-NEXT: `-ParmVarDecl {{.+}} 'int'
914+
915+
}

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
491491
// To format JSON insert a variable to trick the code into thinking its
492492
// JavaScript.
493493
if (IsJson && !FormatStyle->DisableFormat) {
494-
auto Err = Replaces.add(tooling::Replacement(
495-
tooling::Replacement(AssumedFileName, 0, 0, "x = ")));
494+
auto Err =
495+
Replaces.add(tooling::Replacement(AssumedFileName, 0, 0, "x = "));
496496
if (Err)
497497
llvm::errs() << "Bad Json variable insertion\n";
498498
}

0 commit comments

Comments
 (0)