Skip to content

Commit b3f9258

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/s32-shift
2 parents 65ff476 + 639cafd commit b3f9258

File tree

120 files changed

+2535
-382
lines changed

Some content is hidden

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

120 files changed

+2535
-382
lines changed

clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ using namespace clang::ast_matchers;
1515
namespace clang::tidy::bugprone {
1616

1717
void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
18-
auto CtorInitializerList =
19-
cxxConstructorDecl(hasAnyConstructorInitializer(anything()));
20-
2118
Finder->addMatcher(
2219
cxxConstructExpr(
2320
hasType(cxxRecordDecl(
@@ -27,7 +24,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2724
stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
2825
hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
2926
hasAncestor(expr(cxxNewExpr(hasAnyPlacementArg(anything())))),
30-
allOf(hasAncestor(CtorInitializerList),
27+
allOf(hasAncestor(cxxConstructorDecl()),
3128
unless(hasAncestor(cxxCatchStmt()))))))
3229
.bind("temporary-exception-not-thrown"),
3330
this);

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ Changes in existing checks
177177
usages of ``sizeof()``, ``alignof()``, and ``offsetof()`` when adding or
178178
subtracting from a pointer directly or when used to scale a numeric value.
179179

180+
- Improved :doc:`bugprone-throw-keyword-missing
181+
<clang-tidy/checks/bugprone/throw-keyword-missing>` by fixing a false positive
182+
when using non-static member initializers and a constructor.
183+
180184
- Improved :doc:`bugprone-unchecked-optional-access
181185
<clang-tidy/checks/bugprone/unchecked-optional-access>` to support
182186
`bsl::optional` and `bdlb::NullableValue` from

clang-tools-extra/test/clang-tidy/checkers/bugprone/throw-keyword-missing.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ CtorInitializerListTest::CtorInitializerListTest(float) try : exc(RegularExcepti
139139
RegularException();
140140
}
141141

142+
namespace GH115055 {
143+
class CtorInitializerListTest2 {
144+
public:
145+
CtorInitializerListTest2() {}
146+
private:
147+
RegularException exc{};
148+
};
149+
} // namespace GH115055
150+
142151
RegularException funcReturningExceptionTest(int i) {
143152
return RegularException();
144153
}

libc/src/math/generic/log1p.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,8 @@ constexpr Float128 BIG_COEFFS[4]{
822822
{Sign::NEG, -128, 0x80000000'00000000'00000000'00000000_u128},
823823
};
824824

825-
LIBC_INLINE double log1p_accurate(int e_x, int index,
826-
fputil::DoubleDouble m_x) {
825+
[[maybe_unused]] LIBC_INLINE double log1p_accurate(int e_x, int index,
826+
fputil::DoubleDouble m_x) {
827827
Float128 e_x_f128(static_cast<float>(e_x));
828828
Float128 sum = fputil::quick_mul(LOG_2, e_x_f128);
829829
sum = fputil::quick_add(sum, LOG_R1[index]);
@@ -882,7 +882,6 @@ LLVM_LIBC_FUNCTION(double, log1p, (double x)) {
882882

883883
constexpr int EXP_BIAS = FPBits_t::EXP_BIAS;
884884
constexpr int FRACTION_LEN = FPBits_t::FRACTION_LEN;
885-
constexpr uint64_t FRACTION_MASK = FPBits_t::FRACTION_MASK;
886885
FPBits_t xbits(x);
887886
uint64_t x_u = xbits.uintval();
888887

@@ -954,12 +953,12 @@ LLVM_LIBC_FUNCTION(double, log1p, (double x)) {
954953
// |x_dd.lo| < ulp(x_dd.hi)
955954

956955
FPBits_t xhi_bits(x_dd.hi);
956+
uint64_t xhi_frac = xhi_bits.get_mantissa();
957957
x_u = xhi_bits.uintval();
958958
// Range reduction:
959959
// Find k such that |x_hi - k * 2^-7| <= 2^-8.
960-
int idx =
961-
static_cast<int>(((x_u & FRACTION_MASK) + (1ULL << (FRACTION_LEN - 8))) >>
962-
(FRACTION_LEN - 7));
960+
int idx = static_cast<int>((xhi_frac + (1ULL << (FRACTION_LEN - 8))) >>
961+
(FRACTION_LEN - 7));
963962
int x_e = xhi_bits.get_exponent() + (idx >> 7);
964963
double e_x = static_cast<double>(x_e);
965964

@@ -974,17 +973,21 @@ LLVM_LIBC_FUNCTION(double, log1p, (double x)) {
974973
constexpr double ERR_HI[2] = {0x1.0p-85, 0.0};
975974
double err_hi = ERR_HI[hi == 0.0];
976975

977-
// Scaling factior = 2^(-xh_bits.get_exponent())
978-
uint64_t s_u = (static_cast<uint64_t>(EXP_BIAS) << (FRACTION_LEN + 1)) -
979-
(x_u & FPBits_t::EXP_MASK);
980-
// When the exponent of x is 2^1023, its inverse, 2^(-1023), is subnormal.
981-
const double EXPONENT_CORRECTION[2] = {0.0, 0x1.0p-1023};
982-
double scaling = FPBits_t(s_u).get_val() + EXPONENT_CORRECTION[s_u == 0];
976+
// Scale x_dd by 2^(-xh_bits.get_exponent()).
977+
int64_t s_u = static_cast<int64_t>(x_u & FPBits_t::EXP_MASK) -
978+
(static_cast<int64_t>(EXP_BIAS) << FRACTION_LEN);
983979
// Normalize arguments:
984980
// 1 <= m_dd.hi < 2
985981
// |m_dd.lo| < 2^-52.
986982
// This is exact.
987-
fputil::DoubleDouble m_dd{scaling * x_dd.lo, scaling * x_dd.hi};
983+
uint64_t m_hi = FPBits_t::one().uintval() | xhi_frac;
984+
985+
uint64_t m_lo =
986+
FPBits_t(x_dd.lo).abs().get_val() > x_dd.hi * 0x1.0p-127
987+
? static_cast<uint64_t>(cpp::bit_cast<int64_t>(x_dd.lo) - s_u)
988+
: 0;
989+
990+
fputil::DoubleDouble m_dd{FPBits_t(m_lo).get_val(), FPBits_t(m_hi).get_val()};
988991

989992
// Perform range reduction:
990993
// r * m - 1 = r * (m_dd.hi + m_dd.lo) - 1

libc/test/src/math/smoke/log1p_test.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "test/UnitTest/FPMatcher.h"
1414
#include "test/UnitTest/Test.h"
1515

16-
#include <stdint.h>
17-
1816
using LlvmLibcLog1pTest = LIBC_NAMESPACE::testing::FPTest<double>;
1917

2018
TEST_F(LlvmLibcLog1pTest, SpecialNumbers) {
@@ -26,6 +24,9 @@ TEST_F(LlvmLibcLog1pTest, SpecialNumbers) {
2624
EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0));
2725
EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0),
2826
FE_DIVBYZERO);
27+
28+
EXPECT_FP_EQ(0x1.62c829bf8fd9dp9,
29+
LIBC_NAMESPACE::log1p(0x1.9b536cac3a09dp1023));
2930
}
3031

3132
#ifdef LIBC_TEST_FTZ_DAZ
@@ -36,18 +37,24 @@ TEST_F(LlvmLibcLog1pTest, FTZMode) {
3637
ModifyMXCSR mxcsr(FTZ);
3738

3839
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::log1p(min_denormal));
40+
EXPECT_FP_EQ(0x1.62c829bf8fd9dp9,
41+
LIBC_NAMESPACE::log1p(0x1.9b536cac3a09dp1023));
3942
}
4043

4144
TEST_F(LlvmLibcLog1pTest, DAZMode) {
4245
ModifyMXCSR mxcsr(DAZ);
4346

4447
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::log1p(min_denormal));
48+
EXPECT_FP_EQ(0x1.62c829bf8fd9dp9,
49+
LIBC_NAMESPACE::log1p(0x1.9b536cac3a09dp1023));
4550
}
4651

4752
TEST_F(LlvmLibcLog1pTest, FTZDAZMode) {
4853
ModifyMXCSR mxcsr(FTZ | DAZ);
4954

5055
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::log1p(min_denormal));
56+
EXPECT_FP_EQ(0x1.62c829bf8fd9dp9,
57+
LIBC_NAMESPACE::log1p(0x1.9b536cac3a09dp1023));
5158
}
5259

5360
#endif

lld/COFF/InputFiles.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,8 @@ void BitcodeFile::parseLazy() {
12791279
}
12801280

12811281
MachineTypes BitcodeFile::getMachineType() const {
1282-
switch (Triple(obj->getTargetTriple()).getArch()) {
1282+
Triple t(obj->getTargetTriple());
1283+
switch (t.getArch()) {
12831284
case Triple::x86_64:
12841285
return AMD64;
12851286
case Triple::x86:
@@ -1288,7 +1289,7 @@ MachineTypes BitcodeFile::getMachineType() const {
12881289
case Triple::thumb:
12891290
return ARMNT;
12901291
case Triple::aarch64:
1291-
return ARM64;
1292+
return t.isWindowsArm64EC() ? ARM64EC : ARM64;
12921293
default:
12931294
return IMAGE_FILE_MACHINE_UNKNOWN;
12941295
}

lld/test/COFF/Inputs/loadconfig-arm64ec.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ __guard_dispatch_icall_fptr:
2626
.xword 0
2727
__os_arm64x_dispatch_call_no_redirect:
2828
.xword 0
29+
.globl __os_arm64x_dispatch_ret
2930
__os_arm64x_dispatch_ret:
3031
.xword 0
3132
__os_arm64x_check_call:

lld/test/COFF/arm64ec-pdb.test

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,25 @@ CHECK-NEXT: pdb file ni: 1 `{{.*}}out.pdb`, src file ni: 0 ``
7474
CHECK: Public Symbols
7575
CHECK-NEXT: ============================================================
7676
CHECK-NEXT: Records
77-
CHECK-NEXT: 544 | S_PUB32 [size = 28] `x86_64_sym`
77+
CHECK-NEXT: 584 | S_PUB32 [size = 28] `x86_64_sym`
7878
CHECK-NEXT: flags = none, addr = 0005:0008
79-
CHECK-NEXT: 496 | S_PUB32 [size = 28] `arm64ec_sym`
79+
CHECK-NEXT: 536 | S_PUB32 [size = 28] `arm64ec_sym`
8080
CHECK-NEXT: flags = none, addr = 0005:0000
8181
CHECK-NEXT: 168 | S_PUB32 [size = 44] `__hybrid_auxiliary_iat_copy`
8282
CHECK-NEXT: flags = none, addr = 0002:
8383
CHECK-NEXT: 96 | S_PUB32 [size = 32] `__chpe_metadata`
8484
CHECK-NEXT: flags = none, addr = 0003:0000
85-
CHECK-NEXT: 416 | S_PUB32 [size = 48] `__x64_code_ranges_to_entry_points`
85+
CHECK-NEXT: 456 | S_PUB32 [size = 48] `__x64_code_ranges_to_entry_points`
8686
CHECK-NEXT: flags = none, addr = 0002:
8787
CHECK-NEXT: 0 | S_PUB32 [size = 20] `#func`
8888
CHECK-NEXT: flags = function, addr = 0001:0008
8989
CHECK-NEXT: 244 | S_PUB32 [size = 40] `__icall_helper_arm64ec`
9090
CHECK-NEXT: flags = none, addr = 0001:0000
9191
CHECK-NEXT: 64 | S_PUB32 [size = 32] `__auximpcopy_func`
9292
CHECK-NEXT: flags = none, addr = 0002:
93-
CHECK-NEXT: 464 | S_PUB32 [size = 32] `_load_config_used`
93+
CHECK-NEXT: 504 | S_PUB32 [size = 32] `_load_config_used`
9494
CHECK-NEXT: flags = none, addr = 0002:
95-
CHECK-NEXT: 524 | S_PUB32 [size = 20] `func`
95+
CHECK-NEXT: 564 | S_PUB32 [size = 20] `func`
9696
CHECK-NEXT: flags = function, addr = 0001:4096
9797
CHECK-NEXT: 128 | S_PUB32 [size = 40] `__hybrid_auxiliary_iat`
9898
CHECK-NEXT: flags = none, addr = 0002:8192
@@ -106,6 +106,8 @@ CHECK-NEXT: 212 | S_PUB32 [size = 32] `__hybrid_code_map`
106106
CHECK-NEXT: flags = none, addr = 0002:
107107
CHECK-NEXT: 20 | S_PUB32 [size = 44] `__arm64x_redirection_metadata`
108108
CHECK-NEXT: flags = none, addr = 0004:0000
109+
CHECK-NEXT: 416 | S_PUB32 [size = 40] `__os_arm64x_dispatch_ret`
110+
CHECK-NEXT: flags = none, addr = 0002:
109111
CHECK-NEXT: 316 | S_PUB32 [size = 28] `__imp_func`
110112
CHECK-NEXT: flags = none, addr = 0002:8192
111113

lld/test/COFF/lto-arm64ec.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; REQUIRES: aarch64, x86
2+
3+
; RUN: llvm-as %s -o %t.obj
4+
; RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o %t-loadconfig.obj
5+
6+
; RUN: lld-link -machine:arm64ec %t.obj %t-loadconfig.obj -out:%t.exe -subsystem:console
7+
; RUN: llvm-objdump -d %t.exe | FileCheck %s
8+
9+
; CHECK: 0000000140001000 <.text>:
10+
; CHECK-NEXT: 140001000: 00000009 udf #0x9
11+
; CHECK-NEXT: 140001004: 52800020 mov w0, #0x1 // =1
12+
; CHECK-NEXT: 140001008: d65f03c0 ret
13+
14+
; CHECK: 0000000140002000 <.hexpthk>:
15+
; CHECK-NEXT: 140002000: 48 8b c4 movq %rsp, %rax
16+
; CHECK-NEXT: 140002003: 48 89 58 20 movq %rbx, 0x20(%rax)
17+
; CHECK-NEXT: 140002007: 55 pushq %rbp
18+
; CHECK-NEXT: 140002008: 5d popq %rbp
19+
; CHECK-NEXT: 140002009: e9 f6 ef ff ff jmp 0x140001004 <.text+0x4>
20+
; CHECK-NEXT: 14000200e: cc int3
21+
; CHECK-NEXT: 14000200f: cc int3
22+
23+
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32"
24+
target triple = "arm64ec-unknown-windows-msvc"
25+
26+
define dso_local i32 @mainCRTStartup() {
27+
entry:
28+
ret i32 1
29+
}

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ bool DAP::HandleObject(const llvm::json::Object &object) {
692692
const auto packet_type = GetString(object, "type");
693693
if (packet_type == "request") {
694694
const auto command = GetString(object, "command");
695-
auto handler_pos = request_handlers.find(std::string(command));
695+
auto handler_pos = request_handlers.find(command);
696696
if (handler_pos != request_handlers.end()) {
697697
handler_pos->second(object);
698698
return true; // Success

0 commit comments

Comments
 (0)