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

File tree

46 files changed

+621
-701
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 10 additions & 10 deletions
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

Lines changed: 4 additions & 0 deletions
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
Lines changed: 20 additions & 0 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 42 additions & 0 deletions
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

Lines changed: 42 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)

0 commit comments

Comments
 (0)