Skip to content

Commit 04d95fa

Browse files
Kewen12cachemeifyoucan
authored andcommitted
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.7 [skip ci]
2 parents 99e5fe8 + 346da3d commit 04d95fa

File tree

68 files changed

+762
-723
lines changed

Some content is hidden

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

68 files changed

+762
-723
lines changed

.github/workflows/llvm-bugs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
url : issue.data.html_url,
5353
labels : issue.data.labels.map((label) => label.name),
5454
assignee : issue.data.assignees.map((assignee) => assignee.login),
55-
body : issue.data.body
55+
body : maybeTruncatedBody
5656
};
5757
5858
const data = {

clang/lib/Sema/SemaFunctionEffects.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,8 +1208,16 @@ class Analyzer {
12081208
return true;
12091209
}
12101210

1211-
// No Decl, just an Expr. Just check based on its type.
1212-
checkIndirectCall(Call, CalleeExpr->getType());
1211+
// No Decl, just an Expr. Just check based on its type. Bound member
1212+
// functions are a special expression type and need to be specially
1213+
// unpacked.
1214+
QualType CalleeExprQT = CalleeExpr->getType();
1215+
if (CalleeExpr->isBoundMemberFunction(Outer.S.getASTContext())) {
1216+
QualType QT = Expr::findBoundMemberType(CalleeExpr);
1217+
if (!QT.isNull())
1218+
CalleeExprQT = QT;
1219+
}
1220+
checkIndirectCall(Call, CalleeExprQT);
12131221

12141222
return true;
12151223
}

clang/test/Sema/attr-nonblocking-constraints.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,35 @@ void nb13() [[clang::nonblocking]] { nb12(); }
235235
// C++ member function pointers
236236
struct PTMFTester {
237237
typedef void (PTMFTester::*ConvertFunction)() [[clang::nonblocking]];
238-
239-
void convert() [[clang::nonblocking]];
238+
typedef void (PTMFTester::*BlockingFunction)();
240239

241240
ConvertFunction mConvertFunc;
242-
};
243241

244-
void PTMFTester::convert() [[clang::nonblocking]]
245-
{
246-
(this->*mConvertFunc)();
247-
}
242+
void convert() [[clang::nonblocking]]
243+
{
244+
(this->*mConvertFunc)(); // This should not generate a warning.
245+
}
246+
247+
template <typename T>
248+
struct Holder {
249+
T value;
250+
251+
T& operator*() { return value; }
252+
};
253+
254+
255+
void ptmfInExpr(Holder<ConvertFunction>& holder) [[clang::nonblocking]]
256+
{
257+
(this->*(*holder))(); // Should not generate a warning.
258+
((*this).*(*holder))(); // Should not generate a warning.
259+
}
260+
261+
void ptmfInExpr(Holder<BlockingFunction>& holder) [[clang::nonblocking]]
262+
{
263+
(this->*(*holder))(); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' expression}}
264+
((*this).*(*holder))(); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' expression}}
265+
}
266+
};
248267

249268
// Allow implicit conversion from array to pointer.
250269
void nb14(unsigned idx) [[clang::nonblocking]]

libc/src/stdio/CMakeLists.txt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ add_entrypoint_object(
125125
DEPENDS
126126
libc.src.stdio.printf_core.printf_main
127127
libc.src.stdio.printf_core.writer
128-
libc.src.stdio.printf_core.core_structs
129-
libc.src.stdio.printf_core.error_mapper
130-
libc.src.__support.libc_errno
131-
libc.src.__support.CPP.limits
132128
)
133129

134130
add_entrypoint_object(
@@ -140,10 +136,6 @@ add_entrypoint_object(
140136
DEPENDS
141137
libc.src.stdio.printf_core.printf_main
142138
libc.src.stdio.printf_core.writer
143-
libc.src.stdio.printf_core.core_structs
144-
libc.src.stdio.printf_core.error_mapper
145-
libc.src.__support.libc_errno
146-
libc.src.__support.CPP.limits
147139
)
148140

149141
add_entrypoint_object(
@@ -154,10 +146,6 @@ add_entrypoint_object(
154146
asprintf.h
155147
DEPENDS
156148
libc.src.stdio.printf_core.vasprintf_internal
157-
libc.src.stdio.printf_core.core_structs
158-
libc.src.stdio.printf_core.error_mapper
159-
libc.src.__support.libc_errno
160-
libc.src.__support.CPP.limits
161149
)
162150

163151
add_entrypoint_object(
@@ -169,10 +157,6 @@ add_entrypoint_object(
169157
DEPENDS
170158
libc.src.stdio.printf_core.printf_main
171159
libc.src.stdio.printf_core.writer
172-
libc.src.stdio.printf_core.core_structs
173-
libc.src.stdio.printf_core.error_mapper
174-
libc.src.__support.libc_errno
175-
libc.src.__support.CPP.limits
176160
)
177161

178162
add_entrypoint_object(
@@ -184,10 +168,6 @@ add_entrypoint_object(
184168
DEPENDS
185169
libc.src.stdio.printf_core.printf_main
186170
libc.src.stdio.printf_core.writer
187-
libc.src.stdio.printf_core.core_structs
188-
libc.src.stdio.printf_core.error_mapper
189-
libc.src.__support.libc_errno
190-
libc.src.__support.CPP.limits
191171
)
192172

193173
add_entrypoint_object(
@@ -198,10 +178,6 @@ add_entrypoint_object(
198178
vasprintf.h
199179
DEPENDS
200180
libc.src.stdio.printf_core.vasprintf_internal
201-
libc.src.stdio.printf_core.core_structs
202-
libc.src.stdio.printf_core.error_mapper
203-
libc.src.__support.libc_errno
204-
libc.src.__support.CPP.limits
205181
)
206182

207183
add_subdirectory(printf_core)

libc/src/stdio/asprintf.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdio/asprintf.h"
10-
#include "src/__support/CPP/limits.h"
1110
#include "src/__support/arg_list.h"
12-
#include "src/__support/libc_errno.h"
1311
#include "src/__support/macros/config.h"
14-
#include "src/stdio/printf_core/core_structs.h"
15-
#include "src/stdio/printf_core/error_mapper.h"
1612
#include "src/stdio/printf_core/vasprintf_internal.h"
1713

1814
namespace LIBC_NAMESPACE_DECL {
@@ -26,18 +22,8 @@ LLVM_LIBC_FUNCTION(int, asprintf,
2622
// and pointer semantics, as well as handling
2723
// destruction automatically.
2824
va_end(vlist);
29-
auto ret_val = printf_core::vasprintf_internal(buffer, format, args);
30-
if (!ret_val.has_value()) {
31-
libc_errno = printf_core::internal_error_to_errno(ret_val.error());
32-
return -1;
33-
}
34-
if (ret_val.value() > cpp::numeric_limits<int>::max()) {
35-
libc_errno =
36-
printf_core::internal_error_to_errno(-printf_core::OVERFLOW_ERROR);
37-
return -1;
38-
}
39-
40-
return static_cast<int>(ret_val.value());
25+
int ret = printf_core::vasprintf_internal(buffer, format, args);
26+
return ret;
4127
}
4228

4329
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdio/baremetal/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ add_entrypoint_object(
2929
DEPENDS
3030
libc.src.stdio.printf_core.printf_main
3131
libc.src.stdio.printf_core.writer
32-
libc.src.stdio.printf_core.error_mapper
33-
libc.src.stdio.printf_core.core_structs
3432
libc.src.__support.arg_list
3533
libc.src.__support.OSUtil.osutil
36-
libc.src.__support.libc_errno
37-
libc.src.__support.CPP.limits
3834
)
3935

4036
add_entrypoint_object(
@@ -91,12 +87,8 @@ add_entrypoint_object(
9187
DEPENDS
9288
libc.src.stdio.printf_core.printf_main
9389
libc.src.stdio.printf_core.writer
94-
libc.src.stdio.printf_core.error_mapper
95-
libc.src.stdio.printf_core.core_structs
9690
libc.src.__support.arg_list
9791
libc.src.__support.OSUtil.osutil
98-
libc.src.__support.libc_errno
99-
libc.src.__support.CPP.limits
10092
)
10193

10294
add_entrypoint_object(

libc/src/stdio/baremetal/printf.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdio/printf.h"
10-
#include "src/__support/CPP/limits.h"
1110
#include "src/__support/OSUtil/io.h"
1211
#include "src/__support/arg_list.h"
13-
#include "src/__support/libc_errno.h"
1412
#include "src/__support/macros/config.h"
1513
#include "src/stdio/printf_core/core_structs.h"
16-
#include "src/stdio/printf_core/error_mapper.h"
1714
#include "src/stdio/printf_core/printf_main.h"
1815
#include "src/stdio/printf_core/writer.h"
1916

@@ -45,25 +42,13 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) {
4542
buffer, BUFF_SIZE, &stdout_write_hook, nullptr);
4643
printf_core::Writer<printf_core::WriteMode::FLUSH_TO_STREAM> writer(wb);
4744

48-
auto retval = printf_core::printf_main(&writer, format, args);
49-
if (!retval.has_value()) {
50-
libc_errno = printf_core::internal_error_to_errno(retval.error());
51-
return -1;
52-
}
45+
int retval = printf_core::printf_main(&writer, format, args);
5346

5447
int flushval = wb.overflow_write("");
55-
if (flushval != printf_core::WRITE_OK) {
56-
libc_errno = printf_core::internal_error_to_errno(-flushval);
57-
return -1;
58-
}
48+
if (flushval != printf_core::WRITE_OK)
49+
retval = flushval;
5950

60-
if (retval.value() > cpp::numeric_limits<int>::max()) {
61-
libc_errno =
62-
printf_core::internal_error_to_errno(-printf_core::OVERFLOW_ERROR);
63-
return -1;
64-
}
65-
66-
return static_cast<int>(retval.value());
51+
return retval;
6752
}
6853

6954
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdio/baremetal/vprintf.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/stdio/vprintf.h"
10-
#include "src/__support/CPP/limits.h"
1110
#include "src/__support/OSUtil/io.h"
1211
#include "src/__support/arg_list.h"
13-
#include "src/__support/libc_errno.h"
1412
#include "src/__support/macros/config.h"
1513
#include "src/stdio/printf_core/core_structs.h"
16-
#include "src/stdio/printf_core/error_mapper.h"
1714
#include "src/stdio/printf_core/printf_main.h"
1815
#include "src/stdio/printf_core/writer.h"
1916

@@ -43,25 +40,13 @@ LLVM_LIBC_FUNCTION(int, vprintf,
4340
buffer, BUFF_SIZE, &stdout_write_hook, nullptr);
4441
printf_core::Writer<printf_core::WriteMode::FLUSH_TO_STREAM> writer(wb);
4542

46-
auto retval = printf_core::printf_main(&writer, format, args);
47-
if (!retval.has_value()) {
48-
libc_errno = printf_core::internal_error_to_errno(retval.error());
49-
return -1;
50-
}
43+
int retval = printf_core::printf_main(&writer, format, args);
5144

5245
int flushval = wb.overflow_write("");
53-
if (flushval != printf_core::WRITE_OK) {
54-
libc_errno = printf_core::internal_error_to_errno(-flushval);
55-
return -1;
56-
}
46+
if (flushval != printf_core::WRITE_OK)
47+
retval = flushval;
5748

58-
if (retval.value() > cpp::numeric_limits<int>::max()) {
59-
libc_errno =
60-
printf_core::internal_error_to_errno(-printf_core::OVERFLOW_ERROR);
61-
return -1;
62-
}
63-
64-
return static_cast<int>(retval.value());
49+
return retval;
6550
}
6651

6752
} // namespace LIBC_NAMESPACE_DECL

libc/src/stdio/generic/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,7 @@ add_generic_entrypoint_object(
393393
list(APPEND fprintf_deps
394394
libc.hdr.types.FILE
395395
libc.src.__support.arg_list
396-
libc.src.__support.CPP.limits
397-
libc.src.__support.libc_errno
398396
libc.src.stdio.printf_core.vfprintf_internal
399-
libc.src.stdio.printf_core.core_structs
400-
libc.src.stdio.printf_core.error_mapper
401397
)
402398

403399
if(LLVM_LIBC_FULL_BUILD)

libc/src/stdio/generic/fprintf.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88

99
#include "src/stdio/fprintf.h"
1010

11-
#include "src/__support/CPP/limits.h"
1211
#include "src/__support/File/file.h"
1312
#include "src/__support/arg_list.h"
1413
#include "src/__support/macros/config.h"
15-
#include "src/stdio/printf_core/core_structs.h"
16-
#include "src/stdio/printf_core/error_mapper.h"
1714
#include "src/stdio/printf_core/vfprintf_internal.h"
1815

1916
#include "hdr/types/FILE.h"
@@ -30,18 +27,8 @@ LLVM_LIBC_FUNCTION(int, fprintf,
3027
// and pointer semantics, as well as handling
3128
// destruction automatically.
3229
va_end(vlist);
33-
auto ret_val = printf_core::vfprintf_internal(stream, format, args);
34-
if (!ret_val.has_value()) {
35-
libc_errno = printf_core::internal_error_to_errno(ret_val.error());
36-
return -1;
37-
}
38-
if (ret_val.value() > cpp::numeric_limits<int>::max()) {
39-
libc_errno =
40-
printf_core::internal_error_to_errno(-printf_core::OVERFLOW_ERROR);
41-
return -1;
42-
}
43-
44-
return static_cast<int>(ret_val.value());
30+
int ret_val = printf_core::vfprintf_internal(stream, format, args);
31+
return ret_val;
4532
}
4633

4734
} // namespace LIBC_NAMESPACE_DECL

0 commit comments

Comments
 (0)