Skip to content

Commit 2780baf

Browse files
authored
Merge branch 'main' into fix/100394
2 parents aaf0ce0 + 208584d commit 2780baf

File tree

24 files changed

+233
-192
lines changed

24 files changed

+233
-192
lines changed

clang/lib/AST/ByteCode/EvaluationResult.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ static bool CheckFieldsInitialized(InterpState &S, SourceLocation Loc,
130130
const Descriptor *Desc = BasePtr.getDeclDesc();
131131
if (const auto *CD = dyn_cast_if_present<CXXRecordDecl>(R->getDecl())) {
132132
const auto &BS = *std::next(CD->bases_begin(), I);
133-
S.FFDiag(BS.getBaseTypeLoc(), diag::note_constexpr_uninitialized_base)
134-
<< B.Desc->getType() << BS.getSourceRange();
133+
SourceLocation TypeBeginLoc = BS.getBaseTypeLoc();
134+
S.FFDiag(TypeBeginLoc, diag::note_constexpr_uninitialized_base)
135+
<< B.Desc->getType() << SourceRange(TypeBeginLoc, BS.getEndLoc());
135136
} else {
136137
S.FFDiag(Desc->getLocation(), diag::note_constexpr_uninitialized_base)
137138
<< B.Desc->getType();

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9107,13 +9107,6 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
91079107
llvm::copy_if(Features, std::back_inserter(FeatureArgs),
91089108
[](StringRef Arg) { return !Arg.starts_with("-target"); });
91099109

9110-
if (TC->getTriple().isAMDGPU()) {
9111-
for (StringRef Feature : llvm::split(Arch.split(':').second, ':')) {
9112-
FeatureArgs.emplace_back(
9113-
Args.MakeArgString(Feature.take_back() + Feature.drop_back()));
9114-
}
9115-
}
9116-
91179110
// TODO: We need to pass in the full target-id and handle it properly in the
91189111
// linker wrapper.
91199112
SmallVector<std::string> Parts{
@@ -9123,7 +9116,7 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
91239116
"kind=" + Kind.str(),
91249117
};
91259118

9126-
if (TC->getDriver().isUsingOffloadLTO() || TC->getTriple().isAMDGPU())
9119+
if (TC->getDriver().isUsingOffloadLTO())
91279120
for (StringRef Feature : FeatureArgs)
91289121
Parts.emplace_back("feature=" + Feature.str());
91299122

clang/test/Driver/amdgpu-openmp-toolchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a:sramecc-:xnack+ \
6565
// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID
6666
// CHECK-TARGET-ID: "-cc1" "-triple" "amdgcn-amd-amdhsa" {{.*}} "-target-cpu" "gfx90a" "-target-feature" "-sramecc" "-target-feature" "+xnack"
67-
// CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp,feature=-sramecc,feature=+xnack
67+
// CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp
6868

6969
// RUN: not %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a,gfx90a:xnack+ \
7070
// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID-ERROR

clang/test/Misc/constexpr-subobj-init-source-ranges.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s --strict-whitespace
2+
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info -fexperimental-new-constant-interpreter %s 2>&1 | FileCheck %s --strict-whitespace
23

34
struct DelBase {
45
constexpr DelBase() = delete;

compiler-rt/test/profile/instrprof-write-file-atexit-explicitly.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: rm -f %t.profraw
12
// RUN: %clang_profgen -o %t -O3 %s
23
// RUN: %run %t %t.profraw
34
// RUN: llvm-profdata merge -o %t.profdata %t.profraw

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ function(get_object_files_for_test result skipped_entrypoints_list)
6868
endif()
6969
get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW")
7070
if(object_file_raw)
71+
# TODO: Remove this once we stop suffixing the target with ".__internal__"
72+
if(fq_target_name STREQUAL "libc.test.include.issignaling_c_test.__unit__" OR fq_target_name STREQUAL "libc.test.include.iscanonical_c_test.__unit__")
73+
string(REPLACE ".__internal__" "" object_file_raw ${object_file_raw})
74+
endif()
7175
list(APPEND dep_obj ${object_file_raw})
7276
endif()
7377
elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_VENDOR_TARGET_TYPE})

libc/include/llvm-libc-macros/math-function-macros.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111

1212
#include "math-macros.h"
1313

14+
#ifndef __cplusplus
15+
#define issignaling(x) \
16+
_Generic((x), \
17+
float: issignalingf, \
18+
double: issignaling, \
19+
long double: issignalingl)(x)
20+
#define iscanonical(x) \
21+
_Generic((x), \
22+
float: iscanonicalf, \
23+
double: iscanonical, \
24+
long double: iscanonicall)(x)
25+
#endif
26+
1427
#define isfinite(x) __builtin_isfinite(x)
1528
#define isinf(x) __builtin_isinf(x)
1629
#define isnan(x) __builtin_isnan(x)
@@ -20,9 +33,5 @@
2033
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
2134
#define isnormal(x) __builtin_isnormal(x)
2235
#define issubnormal(x) (fpclassify(x) == FP_SUBNORMAL)
23-
#if (defined(__clang__) && __clang_major__ >= 18) || \
24-
(defined(__GNUC__) && __GNUC__ >= 13)
25-
#define issignaling(x) __builtin_issignaling(x)
26-
#endif
2736

2837
#endif // LLVM_LIBC_MACROS_MATH_FUNCTION_MACROS_H

libc/test/include/CMakeLists.txt

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,36 +81,6 @@ add_libc_test(
8181
libc.include.llvm-libc-macros.stdckdint_macros
8282
)
8383

84-
add_libc_test(
85-
issignaling_test
86-
SUITE
87-
libc_include_tests
88-
SRCS
89-
issignaling_test.cpp
90-
DEPENDS
91-
libc.include.llvm-libc-macros.math_function_macros
92-
)
93-
94-
add_libc_test(
95-
issignalingf_test
96-
SUITE
97-
libc_include_tests
98-
SRCS
99-
issignalingf_test.cpp
100-
DEPENDS
101-
libc.include.llvm-libc-macros.math_function_macros
102-
)
103-
104-
add_libc_test(
105-
issignalingl_test
106-
SUITE
107-
libc_include_tests
108-
SRCS
109-
issignalingl_test.cpp
110-
DEPENDS
111-
libc.include.llvm-libc-macros.math_function_macros
112-
)
113-
11484
add_libc_test(
11585
issubnormal_test
11686
SUITE
@@ -409,6 +379,27 @@ add_libc_test(
409379
-Werror
410380
DEPENDS
411381
libc.include.llvm-libc-macros.math_function_macros
382+
libc.src.math.issignaling
383+
libc.src.math.issignalingf
384+
libc.src.math.issignalingl
385+
)
386+
387+
add_libc_test(
388+
iscanonical_c_test
389+
C_TEST
390+
UNIT_TEST_ONLY
391+
SUITE
392+
libc_include_tests
393+
SRCS
394+
iscanonical_test.c
395+
COMPILE_OPTIONS
396+
-Wall
397+
-Werror
398+
DEPENDS
399+
libc.include.llvm-libc-macros.math_function_macros
400+
libc.src.math.iscanonical
401+
libc.src.math.iscanonicalf
402+
libc.src.math.iscanonicall
412403
)
413404

414405
add_libc_test(

libc/test/include/IsSignalingTest.h

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===-- Unittests for iscanonical macro -----------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
int iscanonical(double);
9+
int iscanonicalf(float);
10+
int iscanonicall(long double);
11+
12+
#include "include/llvm-libc-macros/math-function-macros.h"
13+
14+
#include <assert.h>
15+
16+
// check if macro is defined
17+
#ifndef iscanonical
18+
#error "iscanonical macro is not defined"
19+
#else
20+
int main(void) {
21+
assert(iscanonical(__builtin_nans("")) == 0);
22+
assert(iscanonical(__builtin_nansf("")) == 0);
23+
assert(iscanonical(__builtin_nansl("")) == 0);
24+
assert(iscanonical(1.819f) == 1);
25+
assert(iscanonical(-1.726) == 1);
26+
assert(iscanonical(1.426L) == 1);
27+
return 0;
28+
}
29+
#endif

0 commit comments

Comments
 (0)