Skip to content

Commit e93b766

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents d9efd04 + 1cff90e commit e93b766

30 files changed

+189
-45
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,10 +2555,13 @@ bool ByteCodeExprGen<Emitter>::visitExpr(const Expr *E) {
25552555
// For us, that means everything we don't
25562556
// have a PrimType for.
25572557
if (std::optional<unsigned> LocalOffset = this->allocateLocal(E)) {
2558-
if (!this->visitLocalInitializer(E, *LocalOffset))
2558+
if (!this->emitGetPtrLocal(*LocalOffset, E))
25592559
return false;
25602560

2561-
if (!this->emitGetPtrLocal(*LocalOffset, E))
2561+
if (!visitInitializer(E))
2562+
return false;
2563+
2564+
if (!this->emitInitPtr(E))
25622565
return false;
25632566
return this->emitRetValue(E);
25642567
}

clang/lib/AST/Interp/EvalEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ EvalEmitter::~EvalEmitter() {
3636
EvaluationResult EvalEmitter::interpretExpr(const Expr *E) {
3737
EvalResult.setSource(E);
3838

39-
if (!this->visitExpr(E))
39+
if (!this->visitExpr(E) && EvalResult.empty())
4040
EvalResult.setInvalid();
4141

4242
return std::move(this->EvalResult);
@@ -45,7 +45,7 @@ EvaluationResult EvalEmitter::interpretExpr(const Expr *E) {
4545
EvaluationResult EvalEmitter::interpretDecl(const VarDecl *VD) {
4646
EvalResult.setSource(VD);
4747

48-
if (!this->visitDecl(VD))
48+
if (!this->visitDecl(VD) && EvalResult.empty())
4949
EvalResult.setInvalid();
5050

5151
return std::move(this->EvalResult);

clang/lib/AST/Interp/Interp.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,13 +1278,16 @@ inline bool GetPtrThisBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
12781278

12791279
inline bool InitPtrPop(InterpState &S, CodePtr OpPC) {
12801280
const Pointer &Ptr = S.Stk.pop<Pointer>();
1281-
Ptr.initialize();
1281+
if (Ptr.canBeInitialized())
1282+
Ptr.initialize();
12821283
return true;
12831284
}
12841285

12851286
inline bool InitPtr(InterpState &S, CodePtr OpPC) {
12861287
const Pointer &Ptr = S.Stk.peek<Pointer>();
1287-
Ptr.initialize();
1288+
1289+
if (Ptr.canBeInitialized())
1290+
Ptr.initialize();
12881291
return true;
12891292
}
12901293

clang/test/AST/Interp/complex.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -Wno-unused-value %s
2+
// RUN: %clang_cc1 -verify=ref,both -Wno-unused-value %s
3+
4+
// expected-no-diagnostics
5+
// ref-no-diagnostics
6+
7+
void blah() {
8+
__complex__ unsigned xx;
9+
__complex__ signed yy;
10+
__complex__ int result;
11+
12+
/// The following line calls into the constant interpreter.
13+
result = xx * yy;
14+
}

clang/tools/scan-build/man/scan-build.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
.\" See https://llvm.org/LICENSE.txt for license information.
33
.\" SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
.\" $Id$
5-
.Dd Sep 21, 2023
5+
.Dd Feb 10, 2024
66
.Dt SCAN-BUILD 1
7-
.Os "clang" "18"
7+
.Os "clang" "19"
88
.Sh NAME
99
.Nm scan-build
1010
.Nd Clang static analyzer

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ static void initializeProfileForContinuousMode(void) {
677677
PROF_ERR("Continuous counter sync mode is enabled, but raw profile is not"
678678
"page-aligned. CurrentFileOffset = %" PRIu64 ", pagesz = %u.\n",
679679
(uint64_t)CurrentFileOffset, PageSize);
680+
fclose(File);
680681
return;
681682
}
682683
if (writeProfileWithFileObject(Filename, File) != 0) {
@@ -692,6 +693,8 @@ static void initializeProfileForContinuousMode(void) {
692693

693694
if (doMerging()) {
694695
lprofUnlockFileHandle(File);
696+
}
697+
if (File != NULL) {
695698
fclose(File);
696699
}
697700
}

flang/lib/Lower/ConvertCall.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,8 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
922922
// Handle procedure arguments (procedure pointers should go through
923923
// prepareProcedurePointerActualArgument).
924924
if (hlfir::isFortranProcedureValue(dummyType)) {
925-
// Procedure pointer actual to procedure dummy.
925+
// Procedure pointer or function returns procedure pointer actual to
926+
// procedure dummy.
926927
if (actual.isProcedurePointer()) {
927928
actual = hlfir::derefPointersAndAllocatables(loc, builder, actual);
928929
return PreparedDummyArgument{actual, /*cleanups=*/{}};
@@ -931,7 +932,11 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
931932
assert(actual.isProcedure());
932933
// Do nothing if this is a procedure argument. It is already a
933934
// fir.boxproc/fir.tuple<fir.boxproc, len> as it should.
934-
if (actual.getType() != dummyType)
935+
if (!actual.getType().isa<fir::BoxProcType>() &&
936+
actual.getType() != dummyType)
937+
// The actual argument may be a procedure that returns character (a
938+
// fir.tuple<fir.boxproc, len>) while the dummy is not. Extract the tuple
939+
// in that case.
935940
actual = fixProcedureDummyMismatch(loc, builder, actual, dummyType);
936941
return PreparedDummyArgument{actual, /*cleanups=*/{}};
937942
}

libcxx/include/print

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace std {
3232
*/
3333

3434
#include <__assert> // all public C++ headers provide the assertion handler
35+
#include <__availability>
3536
#include <__concepts/same_as.h>
3637
#include <__config>
3738
#include <__system_error/system_error.h>
@@ -43,10 +44,6 @@ namespace std {
4344
#include <string_view>
4445
#include <version>
4546

46-
#if __has_include(<unistd.h>)
47-
# include <unistd.h>
48-
#endif
49-
5047
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
5148
# pragma GCC system_header
5249
#endif
@@ -68,7 +65,8 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
6865
// Note the function is only implemented on the Windows platform.
6966
_LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
7067
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
71-
68+
#elif __has_include(<unistd.h>)
69+
_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream);
7270
#endif // _LIBCPP_WIN32API
7371

7472
#if _LIBCPP_STD_VER >= 23
@@ -195,15 +193,17 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE
195193
inline constexpr bool __use_unicode_execution_charset = true;
196194
# endif
197195

198-
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) {
196+
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) {
199197
// The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
200198
// the behavior in the test. This is not part of the public API.
201199
# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
202200
return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
201+
# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0
202+
return false;
203203
# elif defined(_LIBCPP_WIN32API)
204204
return std::__is_windows_terminal(__stream);
205205
# elif __has_include(<unistd.h>)
206-
return isatty(fileno(__stream));
206+
return std::__is_posix_terminal(__stream);
207207
# else
208208
# error "Provide a way to determine whether a FILE* is a terminal"
209209
# endif

libcxx/lib/abi/CHANGELOG.TXT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ New entries should be added directly below the "Version" header.
1616
Version 18.0
1717
------------
1818

19+
* [libc++] Moves is_terminal to the dylib
20+
21+
The patch moves the POSIX implementation of is_terminal to the dylib. This is
22+
needed to avoid using <unistd.h> in public headers.
23+
24+
All platforms
25+
Symbol added: _ZNSt6__ndk119__is_posix_terminalEP7__sFILE
26+
1927
* [libc++abi] Implement __cxa_init_primary_exception and use it to optimize std::make_exception_ptr (#65534)
2028

2129
This patch implements __cxa_init_primary_exception, an extension to the Itanium C++ ABI.

libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,7 @@
14951495
{'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutex8try_lockEv', 'type': 'FUNC'}
14961496
{'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC1Ev', 'type': 'FUNC'}
14971497
{'is_defined': True, 'name': '__ZNSt3__118shared_timed_mutexC2Ev', 'type': 'FUNC'}
1498+
{'is_defined': True, 'name': '__ZNSt3__119__is_posix_terminalEP7__sFILE', 'type': 'FUNC'}
14981499
{'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base11lock_sharedEv', 'type': 'FUNC'}
14991500
{'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base13unlock_sharedEv', 'type': 'FUNC'}
15001501
{'is_defined': True, 'name': '__ZNSt3__119__shared_mutex_base15try_lock_sharedEv', 'type': 'FUNC'}

0 commit comments

Comments
 (0)