| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Test hlfir.as_expr codegen for polymorphic expressions. | ||
|
|
||
| // RUN: fir-opt %s -bufferize-hlfir | FileCheck %s | ||
|
|
||
| !t = !fir.type<t{i:i32}> | ||
| func.func @as_expr_class(%arg0 : !fir.class<!t>, %arg1: !fir.ref<!t>) { | ||
| %0 = hlfir.as_expr %arg0 : (!fir.class<!t>) -> !hlfir.expr<!t?> | ||
| hlfir.assign %0 to %arg1 : !hlfir.expr<!t?>, !fir.ref<!t> | ||
| return | ||
| } | ||
| // CHECK-LABEL: func.func @as_expr_class( | ||
| // CHECK: %[[VAL_5:.*]] = arith.constant true | ||
| // CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = ".tmp"} : (!fir.ref<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>>) -> (!fir.ref<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>>, !fir.ref<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>>) | ||
| // ... copy ... | ||
| // CHECK: %[[VAL_11:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>> | ||
| // CHECK: %[[VAL_12:.*]] = fir.undefined tuple<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>, i1> | ||
| // CHECK: %[[VAL_13:.*]] = fir.insert_value %[[VAL_12]], %[[VAL_5]], [1 : index] : (tuple<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>, i1>, i1) -> tuple<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>, i1> | ||
| // CHECK: %[[VAL_14:.*]] = fir.insert_value %[[VAL_13]], %[[VAL_11]], [0 : index] : (tuple<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>, i1>, !fir.class<!fir.heap<!fir.type<t{i:i32}>>>) -> tuple<!fir.class<!fir.heap<!fir.type<t{i:i32}>>>, i1> | ||
| // CHECK: hlfir.assign %[[VAL_11]] to %{{.*}} : !fir.class<!fir.heap<!fir.type<t{i:i32}>>>, !fir.ref<!fir.type<t{i:i32}>> | ||
|
|
||
|
|
||
| func.func @as_expr_class_2(%arg0 : !fir.class<!fir.array<?x!t>>) { | ||
| %0 = hlfir.as_expr %arg0 : (!fir.class<!fir.array<?x!t>>) -> !hlfir.expr<?x!t?> | ||
| %c1 = arith.constant 1 : index | ||
| %1 = hlfir.apply %0, %c1 : (!hlfir.expr<?x!t?>, index) -> !hlfir.expr<!t?> | ||
| return | ||
| } | ||
| // CHECK-LABEL: func.func @as_expr_class_2( | ||
| // CHECK: %[[VAL_9:.*]] = arith.constant true | ||
| // CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = ".tmp"} : (!fir.ref<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>>) -> (!fir.ref<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>>, !fir.ref<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>>) | ||
| // CHECK: %[[VAL_11:.*]] = arith.constant 1 : i32 | ||
| // ... copy ... | ||
| // CHECK: %[[VAL_15:.*]] = fir.load %[[VAL_10]]#0 : !fir.ref<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>> | ||
| // CHECK: %[[VAL_16:.*]] = fir.undefined tuple<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, i1> | ||
| // CHECK: %[[VAL_17:.*]] = fir.insert_value %[[VAL_16]], %[[VAL_9]], [1 : index] : (tuple<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, i1>, i1) -> tuple<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, i1> | ||
| // CHECK: %[[VAL_18:.*]] = fir.insert_value %[[VAL_17]], %[[VAL_15]], [0 : index] : (tuple<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, i1>, !fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>) -> tuple<!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, i1> | ||
| // CHECK: %[[VAL_19:.*]] = arith.constant 1 : index | ||
| // CHECK: %[[VAL_20:.*]] = hlfir.designate %[[VAL_15]] (%[[VAL_19]]) : (!fir.class<!fir.heap<!fir.array<?x!fir.type<t{i:i32}>>>>, index) -> !fir.class<!fir.type<t{i:i32}>> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,3 +221,9 @@ add_macro_header( | |
| HDR | ||
| wchar-macros.h | ||
| ) | ||
|
|
||
| add_macro_header( | ||
| inttypes_macros | ||
| HDR | ||
| inttypes-macros.h | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,289 @@ | ||
| //===-- Definition of macros from inttypes.h ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| #ifndef __LLVM_LIBC_MACROS_INTTYPES_MACROS_H | ||
| #define __LLVM_LIBC_MACROS_INTTYPES_MACROS_H | ||
|
|
||
| // fprintf/scanf format macros. | ||
| // POSIX.1-2008, Technical Corrigendum 1, XBD/TC1-2008/0050 [211] is applied. | ||
|
|
||
| // clang provides these macros, so we don't need to define them. | ||
| // TODO: ISO C23 will provide binary notations. | ||
|
|
||
| #ifndef __clang__ | ||
| #if __UINTPTR_MAX__ == __UINT64_MAX__ | ||
| #define __PRI64 "l" | ||
| #define __PRIPTR "l" | ||
| #elif __UINTPTR_MAX__ == __UINT32_MAX__ | ||
| #define __PRI64 "ll" | ||
| #define __PRIPTR "" | ||
| #else | ||
| // CHERI achitecture for example, has 128-bit pointers that use special "P" | ||
| // format. | ||
| #error "Unsupported pointer format" | ||
| #endif | ||
| #define __INT8_FMTd__ "hhd" | ||
| #define __INT16_FMTd__ "hd" | ||
| #define __INT32_FMTd__ "d" | ||
| #define __INT64_FMTd__ __PRI64 "d" | ||
| #define __INT_LEAST8_FMTd__ "hhd" | ||
| #define __INT_LEAST16_FMTd__ "hd" | ||
| #define __INT_LEAST32_FMTd__ "d" | ||
| #define __INT_LEAST64_FMTd__ __PRI64 "d" | ||
| #define __INT_FAST8_FMTd__ "hhd" | ||
| #define __INT_FAST16_FMTd__ "hd" | ||
| #define __INT_FAST32_FMTd__ "d" | ||
| #define __INT_FAST64_FMTd__ __PRI64 "d" | ||
| #define __INTMAX_FMTd__ __PRI64 "d" | ||
| #define __INTPTR_FMTd__ __PRIPTR "d" | ||
|
|
||
| #define __INT8_FMTi__ "hhi" | ||
| #define __INT16_FMTi__ "hi" | ||
| #define __INT32_FMTi__ "i" | ||
| #define __INT64_FMTi__ __PRI64 "i" | ||
| #define __INT_LEAST8_FMTi__ "hhi" | ||
| #define __INT_LEAST16_FMTi__ "hi" | ||
| #define __INT_LEAST32_FMTi__ "i" | ||
| #define __INT_LEAST64_FMTi__ __PRI64 "i" | ||
| #define __INT_FAST8_FMTi__ "hhi" | ||
| #define __INT_FAST16_FMTi__ "hi" | ||
| #define __INT_FAST32_FMTi__ "i" | ||
| #define __INT_FAST64_FMTi__ __PRI64 "i" | ||
| #define __INTMAX_FMTi__ __PRI64 "i" | ||
| #define __INTPTR_FMTi__ __PRIPTR "i" | ||
|
|
||
| #define __UINT8_FMTo__ "hho" | ||
| #define __UINT16_FMTo__ "ho" | ||
| #define __UINT32_FMTo__ "o" | ||
| #define __UINT64_FMTo__ __PRI64 "o" | ||
| #define __UINT_LEAST8_FMTo__ "hho" | ||
| #define __UINT_LEAST16_FMTo__ "ho" | ||
| #define __UINT_LEAST32_FMTo__ "o" | ||
| #define __UINT_LEAST64_FMTo__ __PRI64 "o" | ||
| #define __UINT_FAST8_FMTo__ "hho" | ||
| #define __UINT_FAST16_FMTo__ "ho" | ||
| #define __UINT_FAST32_FMTo__ "o" | ||
| #define __UINT_FAST64_FMTo__ __PRI64 "o" | ||
| #define __UINTMAX_FMTo__ __PRI64 "o" | ||
| #define __UINTPTR_FMTo__ __PRIPTR "o" | ||
|
|
||
| #define __UINT8_FMTu__ "hhu" | ||
| #define __UINT16_FMTu__ "hu" | ||
| #define __UINT32_FMTu__ "u" | ||
| #define __UINT64_FMTu__ __PRI64 "u" | ||
| #define __UINT_LEAST8_FMTu__ "hhu" | ||
| #define __UINT_LEAST16_FMTu__ "hu" | ||
| #define __UINT_LEAST32_FMTu__ "u" | ||
| #define __UINT_LEAST64_FMTu__ __PRI64 "u" | ||
| #define __UINT_FAST8_FMTu__ "hhu" | ||
| #define __UINT_FAST16_FMTu__ "hu" | ||
| #define __UINT_FAST32_FMTu__ "u" | ||
| #define __UINT_FAST64_FMTu__ __PRI64 "u" | ||
| #define __UINTMAX_FMTu__ __PRI64 "u" | ||
| #define __UINTPTR_FMTu__ __PRIPTR "u" | ||
|
|
||
| #define __UINT8_FMTx__ "hhx" | ||
| #define __UINT16_FMTx__ "hx" | ||
| #define __UINT32_FMTx__ "x" | ||
| #define __UINT64_FMTx__ __PRI64 "x" | ||
| #define __UINT_LEAST8_FMTx__ "hhx" | ||
| #define __UINT_LEAST16_FMTx__ "hx" | ||
| #define __UINT_LEAST32_FMTx__ "x" | ||
| #define __UINT_LEAST64_FMTx__ __PRI64 "x" | ||
| #define __UINT_FAST8_FMTx__ "hhx" | ||
| #define __UINT_FAST16_FMTx__ "hx" | ||
| #define __UINT_FAST32_FMTx__ "x" | ||
| #define __UINT_FAST64_FMTx__ __PRI64 "x" | ||
| #define __UINTMAX_FMTx__ __PRI64 "x" | ||
| #define __UINTPTR_FMTx__ __PRIPTR "x" | ||
|
|
||
| #define __UINT8_FMTX__ "hhX" | ||
| #define __UINT16_FMTX__ "hX" | ||
| #define __UINT32_FMTX__ "X" | ||
| #define __UINT64_FMTX__ __PRI64 "X" | ||
| #define __UINT_LEAST8_FMTX__ "hhX" | ||
| #define __UINT_LEAST16_FMTX__ "hX" | ||
| #define __UINT_LEAST32_FMTX__ "X" | ||
| #define __UINT_LEAST64_FMTX__ __PRI64 "X" | ||
| #define __UINT_FAST8_FMTX__ "hhX" | ||
| #define __UINT_FAST16_FMTX__ "hX" | ||
| #define __UINT_FAST32_FMTX__ "X" | ||
| #define __UINT_FAST64_FMTX__ __PRI64 "X" | ||
| #define __UINTMAX_FMTX__ __PRI64 "X" | ||
| #define __UINTPTR_FMTX__ __PRIPTR "X" | ||
| #endif | ||
|
|
||
| // The fprintf() macros for signed integers. | ||
| #define PRId8 __INT8_FMTd__ | ||
| #define PRId16 __INT16_FMTd__ | ||
| #define PRId32 __INT32_FMTd__ | ||
| #define PRId64 __INT64_FMTd__ | ||
| #define PRIdLEAST8 __INT_LEAST8_FMTd__ | ||
| #define PRIdLEAST16 __INT_LEAST16_FMTd__ | ||
| #define PRIdLEAST32 __INT_LEAST32_FMTd__ | ||
| #define PRIdLEAST64 __INT_LEAST64_FMTd__ | ||
| #define PRIdFAST8 __INT_FAST8_FMTd__ | ||
| #define PRIdFAST16 __INT_FAST16_FMTd__ | ||
| #define PRIdFAST32 __INT_FAST32_FMTd__ | ||
| #define PRIdFAST64 __INT_FAST64_FMTd__ | ||
| #define PRIdMAX __INTMAX_FMTd__ | ||
| #define PRIdPTR __INTPTR_FMTd__ | ||
|
|
||
| #define PRIi8 __INT8_FMTi__ | ||
| #define PRIi16 __INT16_FMTi__ | ||
| #define PRIi32 __INT32_FMTi__ | ||
| #define PRIi64 __INT64_FMTi__ | ||
| #define PRIiLEAST8 __INT_LEAST8_FMTi__ | ||
| #define PRIiLEAST16 __INT_LEAST16_FMTi__ | ||
| #define PRIiLEAST32 __INT_LEAST32_FMTi__ | ||
| #define PRIiLEAST64 __INT_LEAST64_FMTi__ | ||
| #define PRIiFAST8 __INT_FAST8_FMTi__ | ||
| #define PRIiFAST16 __INT_FAST16_FMTi__ | ||
| #define PRIiFAST32 __INT_FAST32_FMTi__ | ||
| #define PRIiFAST64 __INT_FAST64_FMTi__ | ||
| #define PRIiMAX __INTMAX_FMTi__ | ||
| #define PRIiPTR __INTPTR_FMTi__ | ||
|
|
||
| // The fprintf() macros for unsigned integers. | ||
| #define PRIo8 __UINT8_FMTo__ | ||
| #define PRIo16 __UINT16_FMTo__ | ||
| #define PRIo32 __UINT32_FMTo__ | ||
| #define PRIo64 __UINT64_FMTo__ | ||
| #define PRIoLEAST8 __UINT_LEAST8_FMTo__ | ||
| #define PRIoLEAST16 __UINT_LEAST16_FMTo__ | ||
| #define PRIoLEAST32 __UINT_LEAST32_FMTo__ | ||
| #define PRIoLEAST64 __UINT_LEAST64_FMTo__ | ||
| #define PRIoFAST8 __UINT_FAST8_FMTo__ | ||
| #define PRIoFAST16 __UINT_FAST16_FMTo__ | ||
| #define PRIoFAST32 __UINT_FAST32_FMTo__ | ||
| #define PRIoFAST64 __UINT_FAST64_FMTo__ | ||
| #define PRIoMAX __UINTMAX_FMTo__ | ||
| #define PRIoPTR __UINTPTR_FMTo__ | ||
|
|
||
| #define PRIu8 __UINT8_FMTu__ | ||
| #define PRIu16 __UINT16_FMTu__ | ||
| #define PRIu32 __UINT32_FMTu__ | ||
| #define PRIu64 __UINT64_FMTu__ | ||
| #define PRIuLEAST8 __UINT_LEAST8_FMTu__ | ||
| #define PRIuLEAST16 __UINT_LEAST16_FMTu__ | ||
| #define PRIuLEAST32 __UINT_LEAST32_FMTu__ | ||
| #define PRIuLEAST64 __UINT_LEAST64_FMTu__ | ||
| #define PRIuFAST8 __UINT_FAST8_FMTu__ | ||
| #define PRIuFAST16 __UINT_FAST16_FMTu__ | ||
| #define PRIuFAST32 __UINT_FAST32_FMTu__ | ||
| #define PRIuFAST64 __UINT_FAST64_FMTu__ | ||
| #define PRIuMAX __UINTMAX_FMTu__ | ||
| #define PRIuPTR __UINTPTR_FMTu__ | ||
|
|
||
| #define PRIx8 __UINT8_FMTx__ | ||
| #define PRIx16 __UINT16_FMTx__ | ||
| #define PRIx32 __UINT32_FMTx__ | ||
| #define PRIx64 __UINT64_FMTx__ | ||
| #define PRIxLEAST8 __UINT_LEAST8_FMTx__ | ||
| #define PRIxLEAST16 __UINT_LEAST16_FMTx__ | ||
| #define PRIxLEAST32 __UINT_LEAST32_FMTx__ | ||
| #define PRIxLEAST64 __UINT_LEAST64_FMTx__ | ||
| #define PRIxFAST8 __UINT_FAST8_FMTx__ | ||
| #define PRIxFAST16 __UINT_FAST16_FMTx__ | ||
| #define PRIxFAST32 __UINT_FAST32_FMTx__ | ||
| #define PRIxFAST64 __UINT_FAST64_FMTx__ | ||
| #define PRIxMAX __UINTMAX_FMTx__ | ||
| #define PRIxPTR __UINTPTR_FMTx__ | ||
|
|
||
| #define PRIX8 __UINT8_FMTX__ | ||
| #define PRIX16 __UINT16_FMTX__ | ||
| #define PRIX32 __UINT32_FMTX__ | ||
| #define PRIX64 __UINT64_FMTX__ | ||
| #define PRIXLEAST8 __UINT_LEAST8_FMTX__ | ||
| #define PRIXLEAST16 __UINT_LEAST16_FMTX__ | ||
| #define PRIXLEAST32 __UINT_LEAST32_FMTX__ | ||
| #define PRIXLEAST64 __UINT_LEAST64_FMTX__ | ||
| #define PRIXFAST8 __UINT_FAST8_FMTX__ | ||
| #define PRIXFAST16 __UINT_FAST16_FMTX__ | ||
| #define PRIXFAST32 __UINT_FAST32_FMTX__ | ||
| #define PRIXFAST64 __UINT_FAST64_FMTX__ | ||
| #define PRIXMAX __UINTMAX_FMTX__ | ||
| #define PRIXPTR __UINTPTR_FMTX__ | ||
|
|
||
| // The fscanf() macros for signed integers. | ||
| #define SCNd8 __INT8_FMTd__ | ||
| #define SCNd16 __INT16_FMTd__ | ||
| #define SCNd32 __INT32_FMTd__ | ||
| #define SCNd64 __INT64_FMTd__ | ||
| #define SCNdLEAST8 __INT_LEAST8_FMTd__ | ||
| #define SCNdLEAST16 __INT_LEAST16_FMTd__ | ||
| #define SCNdLEAST32 __INT_LEAST32_FMTd__ | ||
| #define SCNdLEAST64 __INT_LEAST64_FMTd__ | ||
| #define SCNdFAST8 __INT_FAST8_FMTd__ | ||
| #define SCNdFAST16 __INT_FAST16_FMTd__ | ||
| #define SCNdFAST32 __INT_FAST32_FMTd__ | ||
| #define SCNdFAST64 __INT_FAST64_FMTd__ | ||
| #define SCNdMAX __INTMAX_FMTd__ | ||
| #define SCNdPTR __INTPTR_FMTd__ | ||
|
|
||
| #define SCNi8 __INT8_FMTi__ | ||
| #define SCNi16 __INT16_FMTi__ | ||
| #define SCNi32 __INT32_FMTi__ | ||
| #define SCNi64 __INT64_FMTi__ | ||
| #define SCNiLEAST8 __INT_LEAST8_FMTi__ | ||
| #define SCNiLEAST16 __INT_LEAST16_FMTi__ | ||
| #define SCNiLEAST32 __INT_LEAST32_FMTi__ | ||
| #define SCNiLEAST64 __INT_LEAST64_FMTi__ | ||
| #define SCNiFAST8 __INT_FAST8_FMTi__ | ||
| #define SCNiFAST16 __INT_FAST16_FMTi__ | ||
| #define SCNiFAST32 __INT_FAST32_FMTi__ | ||
| #define SCNiFAST64 __INT_FAST64_FMTi__ | ||
| #define SCNiMAX __INTMAX_FMTi__ | ||
| #define SCNiPTR __INTPTR_FMTi__ | ||
|
|
||
| // The fscanf() macros for unsigned integers. | ||
| #define SCNo8 __UINT8_FMTo__ | ||
| #define SCNo16 __UINT16_FMTo__ | ||
| #define SCNo32 __UINT32_FMTo__ | ||
| #define SCNo64 __UINT64_FMTo__ | ||
| #define SCNoLEAST8 __UINT_LEAST8_FMTo__ | ||
| #define SCNoLEAST16 __UINT_LEAST16_FMTo__ | ||
| #define SCNoLEAST32 __UINT_LEAST32_FMTo__ | ||
| #define SCNoLEAST64 __UINT_LEAST64_FMTo__ | ||
| #define SCNoFAST8 __UINT_FAST8_FMTo__ | ||
| #define SCNoFAST16 __UINT_FAST16_FMTo__ | ||
| #define SCNoFAST32 __UINT_FAST32_FMTo__ | ||
| #define SCNoFAST64 __UINT_FAST64_FMTo__ | ||
| #define SCNoMAX __UINTMAX_FMTo__ | ||
| #define SCNoPTR __UINTPTR_FMTo__ | ||
|
|
||
| #define SCNu8 __UINT8_FMTu__ | ||
| #define SCNu16 __UINT16_FMTu__ | ||
| #define SCNu32 __UINT32_FMTu__ | ||
| #define SCNu64 __UINT64_FMTu__ | ||
| #define SCNuLEAST8 __UINT_LEAST8_FMTu__ | ||
| #define SCNuLEAST16 __UINT_LEAST16_FMTu__ | ||
| #define SCNuLEAST32 __UINT_LEAST32_FMTu__ | ||
| #define SCNuLEAST64 __UINT_LEAST64_FMTu__ | ||
| #define SCNuFAST8 __UINT_FAST8_FMTu__ | ||
| #define SCNuFAST16 __UINT_FAST16_FMTu__ | ||
| #define SCNuFAST32 __UINT_FAST32_FMTu__ | ||
| #define SCNuFAST64 __UINT_FAST64_FMTu__ | ||
| #define SCNuMAX __UINTMAX_FMTu__ | ||
| #define SCNuPTR __UINTPTR_FMTu__ | ||
|
|
||
| #define SCNx8 __UINT8_FMTx__ | ||
| #define SCNx16 __UINT16_FMTx__ | ||
| #define SCNx32 __UINT32_FMTx__ | ||
| #define SCNx64 __UINT64_FMTx__ | ||
| #define SCNxLEAST8 __UINT_LEAST8_FMTx__ | ||
| #define SCNxLEAST16 __UINT_LEAST16_FMTx__ | ||
| #define SCNxLEAST32 __UINT_LEAST32_FMTx__ | ||
| #define SCNxLEAST64 __UINT_LEAST64_FMTx__ | ||
| #define SCNxFAST8 __UINT_FAST8_FMTx__ | ||
| #define SCNxFAST16 __UINT_FAST16_FMTx__ | ||
| #define SCNxFAST32 __UINT_FAST32_FMTx__ | ||
| #define SCNxFAST64 __UINT_FAST64_FMTx__ | ||
| #define SCNxMAX __UINTMAX_FMTx__ | ||
| #define SCNxPTR __UINTPTR_FMTx__ | ||
|
|
||
| #endif // __LLVM_LIBC_MACROS_INTTYPES_MACROS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ struct Errno { | |
| operator int(); | ||
| }; | ||
|
|
||
| extern Errno libc_errno; | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,99 +1,20 @@ | ||
| set(prefixes | ||
| leading_zeros | ||
| leading_ones | ||
| trailing_zeros | ||
| trailing_ones | ||
| ) | ||
| set(suffixes c s i l ll) | ||
| foreach(prefix IN LISTS prefixes) | ||
| foreach(suffix IN LISTS suffixes) | ||
| add_entrypoint_object( | ||
| stdc_${prefix}_u${suffix} | ||
| SRCS | ||
| stdc_${prefix}_u${suffix}.cpp | ||
| HDRS | ||
| stdc_${prefix}_u${suffix}.h | ||
| DEPENDS | ||
| libc.src.__support.CPP.bit | ||
| ) | ||
| endforeach() | ||
| endforeach() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_ones_uc ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_ones_uc.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_uc, (unsigned char value)) { | ||
| return static_cast<unsigned>(cpp::countr_one(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_ones_uc --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_ones_uc(unsigned char value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UC_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_ones_ui ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_ones_ui.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ui, (unsigned value)) { | ||
| return static_cast<unsigned>(cpp::countr_one(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_ones_ui --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_ones_ui(unsigned value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UI_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_ones_ul ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_ones_ul.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ul, (unsigned long value)) { | ||
| return static_cast<unsigned>(cpp::countr_one(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_ones_ul --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_ones_ul(unsigned long value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_UL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of stdc_trailing_ones_ull --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_ones_ull.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_ull, | ||
| (unsigned long long value)) { | ||
| return static_cast<unsigned>(cpp::countr_one(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_ones_ull --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_ones_ull(unsigned long long value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_ULL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_ones_us ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_ones_us.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_us, (unsigned short value)) { | ||
| return static_cast<unsigned>(cpp::countr_one(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_ones_us --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_ones_us(unsigned short value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ONES_US_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_zeros_uc --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_zeros_uc.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_uc, (unsigned char value)) { | ||
| return static_cast<unsigned>(cpp::countr_zero(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_zeros_uc --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_zeros_uc(unsigned char value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UC_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_zeros_ui --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_zeros_ui.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ui, (unsigned value)) { | ||
| return static_cast<unsigned>(cpp::countr_zero(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_zeros_ui --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_zeros_ui(unsigned value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UI_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_zeros_ul --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_zeros_ul.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ul, (unsigned long value)) { | ||
| return static_cast<unsigned>(cpp::countr_zero(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_zeros_ul --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_zeros_ul(unsigned long value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_UL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of stdc_trailing_zeros_ull -------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_zeros_ull.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_ull, | ||
| (unsigned long long value)) { | ||
| return static_cast<unsigned>(cpp::countr_zero(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_zeros_ull -------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_zeros_ull(unsigned long long value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_ULL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of stdc_trailing_zeros_us --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/stdbit/stdc_trailing_zeros_us.h" | ||
|
|
||
| #include "src/__support/CPP/bit.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_zeros_us, (unsigned short value)) { | ||
| return static_cast<unsigned>(cpp::countr_zero(value)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //===-- Implementation header for stdc_trailing_zeros_us --------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H | ||
| #define LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| unsigned stdc_trailing_zeros_us(unsigned short value); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_STDBIT_STDC_TRAILING_ZEROS_US_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,112 +1,23 @@ | ||
| add_custom_target(libc-stdbit-tests) | ||
|
|
||
| set(prefixes | ||
| leading_zeros | ||
| leading_ones | ||
| trailing_zeros | ||
| trailing_ones | ||
| ) | ||
| set(suffixes c s i l ll) | ||
| foreach(prefix IN LISTS prefixes) | ||
| foreach(suffix IN LISTS suffixes) | ||
| add_libc_test( | ||
| stdc_${prefix}_u${suffix}_test | ||
| SUITE | ||
| libc-stdbit-tests | ||
| SRCS | ||
| stdc_${prefix}_u${suffix}_test.cpp | ||
| DEPENDS | ||
| libc.src.__support.CPP.limits | ||
| libc.src.stdbit.stdc_${prefix}_u${suffix} | ||
| ) | ||
| endforeach() | ||
| endforeach() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_ones_uc -------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_ones_uc.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUcTest, ALL) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_uc(UCHAR_MAX), | ||
| static_cast<unsigned>(UCHAR_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUcTest, ZeroHot) { | ||
| for (unsigned i = 0U; i != UCHAR_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_uc(~(1U << i)), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_ones_ui -------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_ones_ui.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUiTest, ALL) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ui(UINT_MAX), | ||
| static_cast<unsigned>(UINT_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUiTest, ZeroHot) { | ||
| for (unsigned i = 0U; i != UINT_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ui(~(1U << i)), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_ones_ul -------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_ones_ul.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUlTest, ALL) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ul(ULONG_MAX), | ||
| static_cast<unsigned>(ULONG_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUlTest, ZeroHot) { | ||
| for (unsigned i = 0U; i != ULONG_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ul(~(1UL << i)), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_ones_ull ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_ones_ull.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUllTest, ALL) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ull(ULLONG_MAX), | ||
| static_cast<unsigned>(ULLONG_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUllTest, ZeroHot) { | ||
| for (unsigned i = 0U; i != ULLONG_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_ull(~(1ULL << i)), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_ones_us -------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_ones_us.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUsTest, ALL) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_us(USHRT_MAX), | ||
| static_cast<unsigned>(USHRT_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingOnesUsTest, ZeroHot) { | ||
| for (unsigned i = 0U; i != USHRT_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_ones_us(~(1U << i)), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_zeros_uc ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_zeros_uc.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUcTest, Zero) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_uc(0U), | ||
| static_cast<unsigned>(UCHAR_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUcTest, OneHot) { | ||
| for (unsigned i = 0U; i != UCHAR_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_uc(1U << i), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_zeros_ui ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_zeros_ui.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUiTest, Zero) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ui(0U), | ||
| static_cast<unsigned>(UINT_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUiTest, OneHot) { | ||
| for (unsigned i = 0U; i != UINT_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ui(1U << i), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_zeros_ul ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_zeros_ul.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUlTest, Zero) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ul(0U), | ||
| static_cast<unsigned>(ULONG_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUlTest, OneHot) { | ||
| for (unsigned i = 0U; i != ULONG_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ul(1UL << i), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_zeros_ull -----------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_zeros_ull.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUllTest, Zero) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ull(0U), | ||
| static_cast<unsigned>(ULLONG_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUllTest, OneHot) { | ||
| for (unsigned i = 0U; i != ULLONG_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_ull(1ULL << i), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Unittests for stdc_trailing_zeros_us ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/stdbit/stdc_trailing_zeros_us.h" | ||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUsTest, Zero) { | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_us(0U), | ||
| static_cast<unsigned>(USHRT_WIDTH)); | ||
| } | ||
|
|
||
| TEST(LlvmLibcStdcTrailingZerosUsTest, OneHot) { | ||
| for (unsigned i = 0U; i != USHRT_WIDTH; ++i) | ||
| EXPECT_EQ(LIBC_NAMESPACE::stdc_trailing_zeros_us(1U << i), i); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <list> | ||
|
|
||
| #include "min_allocator.h" | ||
| #include "test_allocator.h" | ||
| #include "test_macros.h" | ||
|
|
||
| template <class T> | ||
| class small_pointer { | ||
| std::uint16_t offset; | ||
| }; | ||
|
|
||
| template <class T> | ||
| class small_iter_allocator { | ||
| public: | ||
| using value_type = T; | ||
| using pointer = small_pointer<T>; | ||
| using size_type = std::int16_t; | ||
| using difference_type = std::int16_t; | ||
|
|
||
| small_iter_allocator() TEST_NOEXCEPT {} | ||
|
|
||
| template <class U> | ||
| small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {} | ||
|
|
||
| T* allocate(std::size_t n); | ||
| void deallocate(T* p, std::size_t); | ||
|
|
||
| friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; } | ||
| friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; } | ||
| }; | ||
|
|
||
| #if __SIZE_WIDTH__ == 64 | ||
|
|
||
| static_assert(sizeof(std::list<int>) == 24, ""); | ||
| static_assert(sizeof(std::list<int, min_allocator<int> >) == 24, ""); | ||
| static_assert(sizeof(std::list<int, test_allocator<int> >) == 40, ""); | ||
| static_assert(sizeof(std::list<int, small_iter_allocator<int> >) == 6, ""); | ||
|
|
||
| static_assert(sizeof(std::list<char>) == 24, ""); | ||
| static_assert(sizeof(std::list<char, min_allocator<char> >) == 24, ""); | ||
| static_assert(sizeof(std::list<char, test_allocator<char> >) == 40, ""); | ||
| static_assert(sizeof(std::list<char, small_iter_allocator<char> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::list<int>) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, min_allocator<int> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, test_allocator<int> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, small_iter_allocator<int> >) == 2, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::list<char>) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, min_allocator<char> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, test_allocator<char> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, small_iter_allocator<char> >) == 2, ""); | ||
|
|
||
| #elif __SIZE_WIDTH__ == 32 | ||
|
|
||
| static_assert(sizeof(std::list<int>) == 12, ""); | ||
| static_assert(sizeof(std::list<int, min_allocator<int> >) == 12, ""); | ||
| static_assert(sizeof(std::list<int, test_allocator<int> >) == 24, ""); | ||
| static_assert(sizeof(std::list<int, small_iter_allocator<int> >) == 6, ""); | ||
|
|
||
| static_assert(sizeof(std::list<char>) == 12, ""); | ||
| static_assert(sizeof(std::list<char, min_allocator<char> >) == 12, ""); | ||
| static_assert(sizeof(std::list<char, test_allocator<char> >) == 24, ""); | ||
| static_assert(sizeof(std::list<char, small_iter_allocator<char> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::list<int>) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, min_allocator<int> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, test_allocator<int> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<int, small_iter_allocator<int> >) == 2, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::list<char>) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, min_allocator<char> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, test_allocator<char> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::list<char, small_iter_allocator<char> >) == 2, ""); | ||
|
|
||
| #else | ||
| # error std::size_t has an unexpected size | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include "min_allocator.h" | ||
| #include "test_allocator.h" | ||
| #include "test_macros.h" | ||
|
|
||
| template <class T> | ||
| class small_pointer { | ||
| std::uint16_t offset; | ||
| }; | ||
|
|
||
| template <class T> | ||
| class small_iter_allocator { | ||
| public: | ||
| using value_type = T; | ||
| using pointer = small_pointer<T>; | ||
| using size_type = std::int16_t; | ||
| using difference_type = std::int16_t; | ||
|
|
||
| small_iter_allocator() TEST_NOEXCEPT {} | ||
|
|
||
| template <class U> | ||
| small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {} | ||
|
|
||
| T* allocate(std::size_t n); | ||
| void deallocate(T* p, std::size_t); | ||
|
|
||
| friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; } | ||
| friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; } | ||
| }; | ||
|
|
||
| #if __SIZE_WIDTH__ == 64 | ||
|
|
||
| static_assert(sizeof(std::vector<bool>) == 24, ""); | ||
| static_assert(sizeof(std::vector<bool, min_allocator<bool> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<bool, test_allocator<bool> >) == 40, ""); | ||
| static_assert(sizeof(std::vector<bool, small_iter_allocator<bool> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<bool>) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, min_allocator<bool> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, test_allocator<bool> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, small_iter_allocator<bool> >) == 2, ""); | ||
|
|
||
| #elif __SIZE_WIDTH__ == 32 | ||
|
|
||
| static_assert(sizeof(std::vector<bool>) == 12, ""); | ||
| static_assert(sizeof(std::vector<bool, min_allocator<bool> >) == 12, ""); | ||
| static_assert(sizeof(std::vector<bool, test_allocator<bool> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<bool, small_iter_allocator<bool> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<bool>) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, min_allocator<bool> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, test_allocator<bool> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<bool, small_iter_allocator<bool> >) == 2, ""); | ||
|
|
||
| #else | ||
| # error std::size_t has an unexpected size | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include "min_allocator.h" | ||
| #include "test_allocator.h" | ||
| #include "test_macros.h" | ||
|
|
||
| template <class T> | ||
| class small_pointer { | ||
| std::uint16_t offset; | ||
| }; | ||
|
|
||
| template <class T> | ||
| class small_iter_allocator { | ||
| public: | ||
| using value_type = T; | ||
| using pointer = small_pointer<T>; | ||
| using size_type = std::int16_t; | ||
| using difference_type = std::int16_t; | ||
|
|
||
| small_iter_allocator() TEST_NOEXCEPT {} | ||
|
|
||
| template <class U> | ||
| small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {} | ||
|
|
||
| T* allocate(std::size_t n); | ||
| void deallocate(T* p, std::size_t); | ||
|
|
||
| friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; } | ||
| friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; } | ||
| }; | ||
|
|
||
| #if __SIZE_WIDTH__ == 64 | ||
|
|
||
| static_assert(sizeof(std::vector<int>) == 24, ""); | ||
| static_assert(sizeof(std::vector<int, min_allocator<int> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<int, test_allocator<int> >) == 40, ""); | ||
| static_assert(sizeof(std::vector<int, small_iter_allocator<int> >) == 6, ""); | ||
|
|
||
| static_assert(sizeof(std::vector<char>) == 24, ""); | ||
| static_assert(sizeof(std::vector<char, min_allocator<char> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<char, test_allocator<char> >) == 40, ""); | ||
| static_assert(sizeof(std::vector<char, small_iter_allocator<char> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<int>) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, min_allocator<int> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, test_allocator<int> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, small_iter_allocator<int> >) == 2, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<char>) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, min_allocator<char> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, test_allocator<char> >) == 8, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, small_iter_allocator<char> >) == 2, ""); | ||
|
|
||
| #elif __SIZE_WIDTH__ == 32 | ||
|
|
||
| static_assert(sizeof(std::vector<int>) == 12, ""); | ||
| static_assert(sizeof(std::vector<int, min_allocator<int> >) == 12, ""); | ||
| static_assert(sizeof(std::vector<int, test_allocator<int> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<int, small_iter_allocator<int> >) == 6, ""); | ||
|
|
||
| static_assert(sizeof(std::vector<char>) == 12, ""); | ||
| static_assert(sizeof(std::vector<char, min_allocator<char> >) == 12, ""); | ||
| static_assert(sizeof(std::vector<char, test_allocator<char> >) == 24, ""); | ||
| static_assert(sizeof(std::vector<char, small_iter_allocator<char> >) == 6, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<int>) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, min_allocator<int> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, test_allocator<int> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<int, small_iter_allocator<int> >) == 2, ""); | ||
|
|
||
| static_assert(TEST_ALIGNOF(std::vector<char>) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, min_allocator<char> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, test_allocator<char> >) == 4, ""); | ||
| static_assert(TEST_ALIGNOF(std::vector<char, small_iter_allocator<char> >) == 2, ""); | ||
|
|
||
| #else | ||
| # error std::size_t has an unexpected size | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| %feature("docstring", | ||
| "A container for options to use when dumping statistics." | ||
| ) lldb::SBStatisticsOptions; | ||
|
|
||
| %feature("docstring", "Sets whether the statistics should only dump a summary." | ||
| ) lldb::SBStatisticsOptions::SetSummaryOnly; | ||
| %feature("docstring", "Gets whether the statistics only dump a summary." | ||
| ) lldb::SBStatisticsOptions::GetSummaryOnly; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //===-- SBStatisticsOptions.h -----------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLDB_API_SBSTATISTICSOPTIONS_H | ||
| #define LLDB_API_SBSTATISTICSOPTIONS_H | ||
|
|
||
| #include "lldb/API/SBDefines.h" | ||
|
|
||
| namespace lldb { | ||
|
|
||
| /// This class handles the verbosity when dumping statistics | ||
| class LLDB_API SBStatisticsOptions { | ||
| public: | ||
| SBStatisticsOptions(); | ||
| SBStatisticsOptions(const lldb::SBStatisticsOptions &rhs); | ||
| ~SBStatisticsOptions(); | ||
|
|
||
| const SBStatisticsOptions &operator=(const lldb::SBStatisticsOptions &rhs); | ||
|
|
||
| void SetSummaryOnly(bool b); | ||
| bool GetSummaryOnly(); | ||
|
|
||
| protected: | ||
| friend class SBTarget; | ||
| const lldb_private::StatisticsOptions &ref() const; | ||
|
|
||
| private: | ||
| std::unique_ptr<lldb_private::StatisticsOptions> m_opaque_up; | ||
| }; | ||
| } // namespace lldb | ||
| #endif // LLDB_API_SBSTATISTICSOPTIONS_H |