Skip to content

Commit 9013f36

Browse files
committed
Merge remote-tracking branch 'upstream/release/18.x' into ldc-release/18.x
2 parents 77babf8 + e6c3289 commit 9013f36

Some content is hidden

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

46 files changed

+621
-701
lines changed

.github/workflows/release-lit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
cd llvm/utils/lit
5959
# Remove 'dev' suffix from lit version.
6060
sed -i 's/ + "dev"//g' lit/__init__.py
61-
python3 setup.py sdist
61+
python3 setup.py sdist bdist_wheel
6262
6363
- name: Upload lit to test.pypi.org
6464
uses: pypa/gh-action-pypi-publish@release/v1

clang/cmake/caches/Release.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# General Options
66
set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
7-
set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "")
7+
set(LLVM_RELEASE_ENABLE_PGO OFF CACHE BOOL "")
88

99
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
1010

clang/include/clang/Basic/Attr.td

+2
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,7 @@ def RegCall : DeclOrTypeAttr {
15901590
}
15911591

15921592
def Final : InheritableAttr {
1593+
let CanPrintOnLeft = 0;
15931594
let Spellings = [CustomKeyword<"final">, CustomKeyword<"sealed">];
15941595
let Accessors = [Accessor<"isSpelledAsSealed", [CustomKeyword<"sealed">]>];
15951596
let SemaHandler = 0;
@@ -2472,6 +2473,7 @@ def Overloadable : Attr {
24722473
}
24732474

24742475
def Override : InheritableAttr {
2476+
let CanPrintOnLeft = 0;
24752477
let Spellings = [CustomKeyword<"override">];
24762478
let SemaHandler = 0;
24772479
// Omitted from docs, since this is language syntax, not an attribute, as far

clang/lib/Format/TokenAnnotator.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -3450,10 +3450,11 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
34503450
for (AnnotatedLine *ChildLine : Line.Children)
34513451
calculateFormattingInformation(*ChildLine);
34523452

3453-
Line.First->TotalLength =
3454-
Line.First->IsMultiline ? Style.ColumnLimit
3455-
: Line.FirstStartColumn + Line.First->ColumnWidth;
3456-
FormatToken *Current = Line.First->Next;
3453+
auto *First = Line.First;
3454+
First->TotalLength = First->IsMultiline
3455+
? Style.ColumnLimit
3456+
: Line.FirstStartColumn + First->ColumnWidth;
3457+
FormatToken *Current = First->Next;
34573458
bool InFunctionDecl = Line.MightBeFunctionDecl;
34583459
bool AlignArrayOfStructures =
34593460
(Style.AlignArrayOfStructures != FormatStyle::AIAS_None &&
@@ -3475,16 +3476,15 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
34753476
if (const bool IsCtorOrDtor = Tok->is(TT_CtorDtorDeclName);
34763477
IsCtorOrDtor ||
34773478
isFunctionDeclarationName(Style.isCpp(), *Tok, Line, ClosingParen)) {
3478-
if (!IsCtorOrDtor) {
3479-
LineIsFunctionDeclaration = true;
3479+
if (!IsCtorOrDtor)
34803480
Tok->setFinalizedType(TT_FunctionDeclarationName);
3481-
}
3481+
LineIsFunctionDeclaration = true;
34823482
SeenName = true;
34833483
break;
34843484
}
34853485
}
34863486

3487-
if (IsCpp && LineIsFunctionDeclaration &&
3487+
if (IsCpp && (LineIsFunctionDeclaration || First->is(TT_CtorDtorDeclName)) &&
34883488
Line.endsWith(tok::semi, tok::r_brace)) {
34893489
auto *Tok = Line.Last->Previous;
34903490
while (Tok->isNot(tok::r_brace))
@@ -3507,7 +3507,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
35073507
if (IsCpp) {
35083508
if (!LineIsFunctionDeclaration) {
35093509
// Annotate */&/&& in `operator` function calls as binary operators.
3510-
for (const auto *Tok = Line.First; Tok; Tok = Tok->Next) {
3510+
for (const auto *Tok = First; Tok; Tok = Tok->Next) {
35113511
if (Tok->isNot(tok::kw_operator))
35123512
continue;
35133513
do {
@@ -3644,7 +3644,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
36443644

36453645
calculateUnbreakableTailLengths(Line);
36463646
unsigned IndentLevel = Line.Level;
3647-
for (Current = Line.First; Current; Current = Current->Next) {
3647+
for (Current = First; Current; Current = Current->Next) {
36483648
if (Current->Role)
36493649
Current->Role->precomputeFormattingInfos(Current);
36503650
if (Current->MatchingParen &&

clang/lib/Headers/__stddef_unreachable.h

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*===-----------------------------------------------------------------------===
88
*/
99

10+
#ifndef __cplusplus
11+
1012
/*
1113
* When -fbuiltin-headers-in-system-modules is set this is a non-modular header
1214
* and needs to behave as if it was textual.
@@ -15,3 +17,5 @@
1517
(__has_feature(modules) && !__building_module(_Builtin_stddef))
1618
#define unreachable() __builtin_unreachable()
1719
#endif
20+
21+
#endif
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This file contain tests to check if override and final are dumped in the
2+
// correct positions.
3+
4+
// RUN: %clang_cc1 -ast-print -x c++ %s -o - | FileCheck %s
5+
6+
// CHECK: class A {
7+
class A {
8+
// CHECK-NEXT: virtual void f();
9+
virtual void f();
10+
11+
// CHECK-NEXT: virtual void g() final;
12+
virtual void g() final;
13+
} AA;
14+
15+
// CHECK: class B : public A {
16+
class B : public A {
17+
// CHECK-NEXT: virtual void f() override {
18+
virtual void f() override {
19+
};
20+
} B;

clang/unittests/Format/TokenAnnotatorTest.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -2595,6 +2595,20 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
25952595
EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_FunctionLBrace);
25962596
EXPECT_BRACE_KIND(Tokens[4], BK_Block);
25972597
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
2598+
2599+
Tokens = annotate("struct Foo {\n"
2600+
" Foo() {};\n"
2601+
" ~Foo() {};\n"
2602+
"};");
2603+
ASSERT_EQ(Tokens.size(), 19u) << Tokens;
2604+
EXPECT_TOKEN(Tokens[3], tok::identifier, TT_CtorDtorDeclName);
2605+
EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_FunctionLBrace);
2606+
EXPECT_BRACE_KIND(Tokens[6], BK_Block);
2607+
EXPECT_BRACE_KIND(Tokens[7], BK_Block);
2608+
EXPECT_TOKEN(Tokens[10], tok::identifier, TT_CtorDtorDeclName);
2609+
EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_FunctionLBrace);
2610+
EXPECT_BRACE_KIND(Tokens[13], BK_Block);
2611+
EXPECT_BRACE_KIND(Tokens[14], BK_Block);
25982612
}
25992613

26002614
TEST_F(TokenAnnotatorTest, StreamOperator) {

compiler-rt/lib/builtins/riscv/restore.S

+42
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#if __riscv_xlen == 32
2424

25+
#ifndef __riscv_32e
26+
2527
.globl __riscv_restore_12
2628
.type __riscv_restore_12,@function
2729
__riscv_restore_12:
@@ -86,8 +88,29 @@ __riscv_restore_0:
8688
addi sp, sp, 16
8789
ret
8890

91+
#else
92+
93+
.globl __riscv_restore_2
94+
.type __riscv_restore_2,@function
95+
.globl __riscv_restore_1
96+
.type __riscv_restore_1,@function
97+
.globl __riscv_restore_0
98+
.type __riscv_restore_0,@function
99+
__riscv_restore_2:
100+
__riscv_restore_1:
101+
__riscv_restore_0:
102+
lw s1, 0(sp)
103+
lw s0, 4(sp)
104+
lw ra, 8(sp)
105+
addi sp, sp, 12
106+
ret
107+
108+
#endif
109+
89110
#elif __riscv_xlen == 64
90111

112+
#ifndef __riscv_64e
113+
91114
.globl __riscv_restore_12
92115
.type __riscv_restore_12,@function
93116
__riscv_restore_12:
@@ -161,6 +184,25 @@ __riscv_restore_0:
161184
addi sp, sp, 16
162185
ret
163186

187+
#else
188+
189+
.globl __riscv_restore_2
190+
.type __riscv_restore_2,@function
191+
.globl __riscv_restore_1
192+
.type __riscv_restore_1,@function
193+
.globl __riscv_restore_0
194+
.type __riscv_restore_0,@function
195+
__riscv_restore_2:
196+
__riscv_restore_1:
197+
__riscv_restore_0:
198+
ld s1, 0(sp)
199+
ld s0, 8(sp)
200+
ld ra, 16(sp)
201+
addi sp, sp, 24
202+
ret
203+
204+
#endif
205+
164206
#else
165207
# error "xlen must be 32 or 64 for save-restore implementation
166208
#endif

compiler-rt/lib/builtins/riscv/save.S

+42
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#if __riscv_xlen == 32
2020

21+
#ifndef __riscv_32e
22+
2123
.globl __riscv_save_12
2224
.type __riscv_save_12,@function
2325
__riscv_save_12:
@@ -92,8 +94,29 @@ __riscv_save_0:
9294
sw ra, 12(sp)
9395
jr t0
9496

97+
#else
98+
99+
.globl __riscv_save_2
100+
.type __riscv_save_2,@function
101+
.globl __riscv_save_1
102+
.type __riscv_save_1,@function
103+
.globl __riscv_save_0
104+
.type __riscv_save_0,@function
105+
__riscv_save_2:
106+
__riscv_save_1:
107+
__riscv_save_0:
108+
addi sp, sp, -12
109+
sw s1, 0(sp)
110+
sw s0, 4(sp)
111+
sw ra, 8(sp)
112+
jr t0
113+
114+
#endif
115+
95116
#elif __riscv_xlen == 64
96117

118+
#ifndef __riscv_64e
119+
97120
.globl __riscv_save_12
98121
.type __riscv_save_12,@function
99122
__riscv_save_12:
@@ -181,6 +204,25 @@ __riscv_save_0:
181204
sd ra, 8(sp)
182205
jr t0
183206

207+
#else
208+
209+
.globl __riscv_save_2
210+
.type __riscv_save_2,@function
211+
.globl __riscv_save_1
212+
.type __riscv_save_1,@function
213+
.globl __riscv_save_0
214+
.type __riscv_save_0,@function
215+
__riscv_save_2:
216+
__riscv_save_1:
217+
__riscv_save_0:
218+
addi sp, sp, -24
219+
sd s1, 0(sp)
220+
sd s0, 8(sp)
221+
sd ra, 16(sp)
222+
jr t0
223+
224+
#endif
225+
184226
#else
185227
# error "xlen must be 32 or 64 for save-restore implementation
186228
#endif

libcxx/include/__format/formatter_floating_point.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ __format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__par
689689
// Let P equal the precision if nonzero, 6 if the precision is not
690690
// specified, or 1 if the precision is 0. Then, if a conversion with
691691
// style E would have an exponent of X:
692-
int __p = std::max(1, (__specs.__has_precision() ? __specs.__precision_ : 6));
692+
int __p = std::max<int>(1, (__specs.__has_precision() ? __specs.__precision_ : 6));
693693
if (__result.__exponent == __result.__last)
694694
// if P > X >= -4, the conversion is with style f or F and precision P - 1 - X.
695695
// By including the radix point it calculates P - (1 + X)

libcxx/include/stddef.h

+10-19
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#if defined(__need_ptrdiff_t) || defined(__need_size_t) || defined(__need_wchar_t) || defined(__need_NULL) || \
11-
defined(__need_wint_t)
12-
13-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
14-
# pragma GCC system_header
15-
# endif
16-
17-
# include_next <stddef.h>
18-
19-
#elif !defined(_LIBCPP_STDDEF_H)
20-
# define _LIBCPP_STDDEF_H
21-
2210
/*
2311
stddef.h synopsis
2412
@@ -36,15 +24,18 @@
3624
3725
*/
3826

39-
# include <__config>
27+
#include <__config>
4028

41-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
42-
# pragma GCC system_header
43-
# endif
29+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
30+
# pragma GCC system_header
31+
#endif
4432

45-
# if __has_include_next(<stddef.h>)
46-
# include_next <stddef.h>
47-
# endif
33+
// Note: This include is outside of header guards because we sometimes get included multiple times
34+
// with different defines and the underlying <stddef.h> will know how to deal with that.
35+
#include_next <stddef.h>
36+
37+
#ifndef _LIBCPP_STDDEF_H
38+
# define _LIBCPP_STDDEF_H
4839

4940
# ifdef __cplusplus
5041
typedef decltype(nullptr) nullptr_t;

lld/COFF/Chunks.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@ void SectionChunk::getRuntimePseudoRelocs(
652652
dyn_cast_or_null<Defined>(file->getSymbol(rel.SymbolTableIndex));
653653
if (!target || !target->isRuntimePseudoReloc)
654654
continue;
655+
// If the target doesn't have a chunk allocated, it may be a
656+
// DefinedImportData symbol which ended up unnecessary after GC.
657+
// Normally we wouldn't eliminate section chunks that are referenced, but
658+
// references within DWARF sections don't count for keeping section chunks
659+
// alive. Thus such dangling references in DWARF sections are expected.
660+
if (!target->getChunk())
661+
continue;
655662
int sizeInBits =
656663
getRuntimePseudoRelocSize(rel.Type, file->ctx.config.machine);
657664
if (sizeInBits == 0) {

lld/test/COFF/autoimport-gc.s

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# REQUIRES: x86
2+
# RUN: split-file %s %t.dir
3+
4+
# RUN: llvm-mc -triple=x86_64-windows-gnu %t.dir/lib.s -filetype=obj -o %t.dir/lib.obj
5+
# RUN: lld-link -out:%t.dir/lib.dll -dll -entry:DllMainCRTStartup %t.dir/lib.obj -lldmingw -implib:%t.dir/lib.lib
6+
7+
# RUN: llvm-mc -triple=x86_64-windows-gnu %t.dir/main.s -filetype=obj -o %t.dir/main.obj
8+
# RUN: lld-link -lldmingw -out:%t.dir/main.exe -entry:main %t.dir/main.obj %t.dir/lib.lib -opt:ref -debug:dwarf
9+
10+
#--- main.s
11+
.global main
12+
.section .text$main,"xr",one_only,main
13+
main:
14+
ret
15+
16+
.global other
17+
.section .text$other,"xr",one_only,other
18+
other:
19+
movq .refptr.variable(%rip), %rax
20+
movl (%rax), %eax
21+
ret
22+
23+
.section .rdata$.refptr.variable,"dr",discard,.refptr.variable
24+
.global .refptr.variable
25+
.refptr.variable:
26+
.quad variable
27+
28+
.section .debug_info
29+
.long 1
30+
.quad variable
31+
.long 2
32+
33+
#--- lib.s
34+
.global variable
35+
.global DllMainCRTStartup
36+
.text
37+
DllMainCRTStartup:
38+
ret
39+
.data
40+
variable:
41+
.long 42

llvm/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
2222
set(LLVM_VERSION_MINOR 1)
2323
endif()
2424
if(NOT DEFINED LLVM_VERSION_PATCH)
25-
set(LLVM_VERSION_PATCH 3)
25+
set(LLVM_VERSION_PATCH 4)
2626
endif()
2727
if(NOT DEFINED LLVM_VERSION_SUFFIX)
2828
set(LLVM_VERSION_SUFFIX)

0 commit comments

Comments
 (0)