| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| set(LLVM_LINK_COMPONENTS | ||
| Core | ||
| Demangle | ||
| FrontendHLSL | ||
| FrontendOpenMP | ||
| MC | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // RUN: %clang_cc1 -std=c++20 -verify %s | ||
| // RUN: %clang_cc1 -std=c++23 -verify %s | ||
| // expected-no-diagnostics | ||
|
|
||
| struct B { | ||
| template <typename S> | ||
| void foo(); | ||
|
|
||
| void bar(); | ||
| }; | ||
|
|
||
| template <typename T, typename S> | ||
| struct A : T { | ||
| auto foo() { | ||
| static_assert(requires { T::template foo<S>(); }); | ||
| static_assert(requires { T::bar(); }); | ||
| } | ||
| }; | ||
|
|
||
| int main() { | ||
| A<B, double> a; | ||
| a.foo(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // RUN: fir-opt -split-input-file -verify-diagnostics %s | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %1 = fir.alloca i32 | ||
| %pinned = fir.alloca i1 | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %s = fir.load %1 : !fir.ref<i32> | ||
| // expected-error@+1{{'fir.cuda_allocate' op pinned and stream cannot appears at the same time}} | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> stream(%s : i32) pinned(%pinned : !fir.ref<i1>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %1 = fir.alloca i32 | ||
| // expected-error@+1{{'fir.cuda_allocate' op expect box to be a reference to/or a class or box type value}} | ||
| %2 = fir.cuda_allocate %1 : !fir.ref<i32> {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %c100 = arith.constant 100 : index | ||
| %7 = fir.alloca !fir.char<1,100> {bindc_name = "msg", uniq_name = "_QFsub1Emsg"} | ||
| %8:2 = hlfir.declare %7 typeparams %c100 {uniq_name = "_QFsub1Emsg"} : (!fir.ref<!fir.char<1,100>>, index) -> (!fir.ref<!fir.char<1,100>>, !fir.ref<!fir.char<1,100>>) | ||
| %9 = fir.embox %8#1 : (!fir.ref<!fir.char<1,100>>) -> !fir.box<!fir.char<1,100>> | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %16 = fir.convert %9 : (!fir.box<!fir.char<1,100>>) -> !fir.box<none> | ||
| // expected-error@+1{{'fir.cuda_allocate' op expect stat attribute when errmsg is provided}} | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> errmsg(%16 : !fir.box<none>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %1 = fir.alloca i32 | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| // expected-error@+1{{'fir.cuda_allocate' op expect errmsg to be a reference to/or a box type value}} | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> errmsg(%1 : !fir.ref<i32>) {cuda_attr = #fir.cuda<device>, hasStat} -> i32 | ||
| return | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // RUN: fir-opt --split-input-file %s | fir-opt --split-input-file | FileCheck %s | ||
|
|
||
| // Simple round trip test of operations. | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // CHECK: fir.cuda_allocate %{{.*}} : !fir.ref<!fir.box<none>> {cuda_attr = #fir.cuda<device>} -> i32 | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %1 = fir.alloca i32 | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %s = fir.load %1 : !fir.ref<i32> | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> stream(%s : i32) {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // CHECK: fir.cuda_allocate %{{.*}} : !fir.ref<!fir.box<none>> stream(%{{.*}} : i32) {cuda_attr = #fir.cuda<device>} -> i32 | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %1 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "b", uniq_name = "_QFsub1Eb"} | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %5:2 = hlfir.declare %1 {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %12 = fir.convert %5#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> source(%12 : !fir.ref<!fir.box<none>>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // CHECK: fir.cuda_allocate %{{.*}} : !fir.ref<!fir.box<none>> source(%{{.*}} : !fir.ref<!fir.box<none>>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %pinned = fir.alloca i1 | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> pinned(%pinned : !fir.ref<i1>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
| return | ||
| } | ||
|
|
||
| // CHECK: fir.cuda_allocate %{{.*}} : !fir.ref<!fir.box<none>> pinned(%{{.*}} : !fir.ref<i1>) {cuda_attr = #fir.cuda<device>} -> i32 | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @_QPsub1() { | ||
| %0 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QFsub1Ea"} | ||
| %4:2 = hlfir.declare %0 {cuda_attr = #fir.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) | ||
| %c100 = arith.constant 100 : index | ||
| %7 = fir.alloca !fir.char<1,100> {bindc_name = "msg", uniq_name = "_QFsub1Emsg"} | ||
| %8:2 = hlfir.declare %7 typeparams %c100 {uniq_name = "_QFsub1Emsg"} : (!fir.ref<!fir.char<1,100>>, index) -> (!fir.ref<!fir.char<1,100>>, !fir.ref<!fir.char<1,100>>) | ||
| %9 = fir.embox %8#1 : (!fir.ref<!fir.char<1,100>>) -> !fir.box<!fir.char<1,100>> | ||
| %11 = fir.convert %4#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>> | ||
| %16 = fir.convert %9 : (!fir.box<!fir.char<1,100>>) -> !fir.box<none> | ||
| %13 = fir.cuda_allocate %11 : !fir.ref<!fir.box<none>> errmsg(%16 : !fir.box<none>) {cuda_attr = #fir.cuda<device>, hasStat} -> i32 | ||
| return | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of macros from fenv_t.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_HDR_FENV_T_H | ||
| #define LLVM_LIBC_HDR_FENV_T_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
|
|
||
| #include "include/llvm-libc-types/fenv_t.h" | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include <fenv.h> | ||
|
|
||
| #endif // LLVM_LIBC_FULL_BUILD | ||
|
|
||
| #endif // LLVM_LIBC_HDR_FENV_T_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of macros from fexcept_t.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_HDR_FEXCEPT_T_H | ||
| #define LLVM_LIBC_HDR_FEXCEPT_T_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
|
|
||
| #include "include/llvm-libc-types/fexcept_t.h" | ||
|
|
||
| #else // Overlay mode | ||
|
|
||
| #include <fenv.h> | ||
|
|
||
| #endif // LLVM_LIBC_FULL_BUILD | ||
|
|
||
| #endif // LLVM_LIBC_HDR_FENV_T_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # REQUIRES: x86 | ||
| # RUN: split-file %s %t.dir | ||
|
|
||
| # RUN: llvm-mc -triple=x86_64-windows-gnu %t.dir/lib.s -filetype=obj -o %t.dir/lib.obj | ||
| # RUN: lld-link -out:%t.dir/lib.dll -dll -entry:DllMainCRTStartup %t.dir/lib.obj -lldmingw -implib:%t.dir/lib.lib | ||
|
|
||
| # RUN: llvm-mc -triple=x86_64-windows-gnu %t.dir/main.s -filetype=obj -o %t.dir/main.obj | ||
| # RUN: lld-link -lldmingw -out:%t.dir/main.exe -entry:main %t.dir/main.obj %t.dir/lib.lib -opt:ref -debug:dwarf | ||
|
|
||
| #--- main.s | ||
| .global main | ||
| .section .text$main,"xr",one_only,main | ||
| main: | ||
| ret | ||
|
|
||
| .global other | ||
| .section .text$other,"xr",one_only,other | ||
| other: | ||
| movq .refptr.variable(%rip), %rax | ||
| movl (%rax), %eax | ||
| ret | ||
|
|
||
| .section .rdata$.refptr.variable,"dr",discard,.refptr.variable | ||
| .global .refptr.variable | ||
| .refptr.variable: | ||
| .quad variable | ||
|
|
||
| .section .debug_info | ||
| .long 1 | ||
| .quad variable | ||
| .long 2 | ||
|
|
||
| #--- lib.s | ||
| .global variable | ||
| .global DllMainCRTStartup | ||
| .text | ||
| DllMainCRTStartup: | ||
| ret | ||
| .data | ||
| variable: | ||
| .long 42 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| //===-- LibCxxProxyArray.cpp-----------------------------------------------===// | ||
| // | ||
| // 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 "LibCxx.h" | ||
|
|
||
| #include "lldb/Core/ValueObject.h" | ||
| #include "lldb/DataFormatters/FormattersHelpers.h" | ||
| #include <optional> | ||
|
|
||
| using namespace lldb; | ||
| using namespace lldb_private; | ||
| using namespace lldb_private::formatters; | ||
|
|
||
| namespace lldb_private { | ||
| namespace formatters { | ||
|
|
||
| /// Data formatter for libc++'s std::"proxy_array". | ||
| /// | ||
| /// A proxy_array's are created by using: | ||
| /// std::gslice_array operator[](const std::gslice& gslicearr); | ||
| /// std::mask_array operator[](const std::valarray<bool>& boolarr); | ||
| /// std::indirect_array operator[](const std::valarray<std::size_t>& indarr); | ||
| /// | ||
| /// These arrays have the following members: | ||
| /// - __vp_ points to std::valarray::__begin_ | ||
| /// - __1d_ an array of offsets of the elements from @a __vp_ | ||
| class LibcxxStdProxyArraySyntheticFrontEnd : public SyntheticChildrenFrontEnd { | ||
| public: | ||
| LibcxxStdProxyArraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); | ||
|
|
||
| ~LibcxxStdProxyArraySyntheticFrontEnd() override; | ||
|
|
||
| llvm::Expected<uint32_t> CalculateNumChildren() override; | ||
|
|
||
| lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override; | ||
|
|
||
| lldb::ChildCacheState Update() override; | ||
|
|
||
| bool MightHaveChildren() override; | ||
|
|
||
| size_t GetIndexOfChildWithName(ConstString name) override; | ||
|
|
||
| private: | ||
| /// A non-owning pointer to the array's __vp_. | ||
| ValueObject *m_base = nullptr; | ||
| /// The type of the array's template argument T. | ||
| CompilerType m_element_type; | ||
| /// The sizeof the array's template argument T. | ||
| uint32_t m_element_size = 0; | ||
|
|
||
| /// A non-owning pointer to the array's __1d_.__begin_. | ||
| ValueObject *m_start = nullptr; | ||
| /// A non-owning pointer to the array's __1d_.__end_. | ||
| ValueObject *m_finish = nullptr; | ||
| /// The type of the __1d_ array's template argument T (size_t). | ||
| CompilerType m_element_type_size_t; | ||
| /// The sizeof the __1d_ array's template argument T (size_t) | ||
| uint32_t m_element_size_size_t = 0; | ||
| }; | ||
|
|
||
| } // namespace formatters | ||
| } // namespace lldb_private | ||
|
|
||
| lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd:: | ||
| LibcxxStdProxyArraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) | ||
| : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() { | ||
| if (valobj_sp) | ||
| Update(); | ||
| } | ||
|
|
||
| lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd:: | ||
| ~LibcxxStdProxyArraySyntheticFrontEnd() { | ||
| // these need to stay around because they are child objects who will follow | ||
| // their parent's life cycle | ||
| // delete m_base; | ||
| } | ||
|
|
||
| llvm::Expected<uint32_t> lldb_private::formatters:: | ||
| LibcxxStdProxyArraySyntheticFrontEnd::CalculateNumChildren() { | ||
|
|
||
| if (!m_start || !m_finish) | ||
| return 0; | ||
| uint64_t start_val = m_start->GetValueAsUnsigned(0); | ||
| uint64_t finish_val = m_finish->GetValueAsUnsigned(0); | ||
|
|
||
| if (start_val == 0 || finish_val == 0) | ||
| return 0; | ||
|
|
||
| if (start_val >= finish_val) | ||
| return 0; | ||
|
|
||
| size_t num_children = (finish_val - start_val); | ||
| if (num_children % m_element_size_size_t) | ||
| return 0; | ||
| return num_children / m_element_size_size_t; | ||
| } | ||
|
|
||
| lldb::ValueObjectSP | ||
| lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::GetChildAtIndex( | ||
| uint32_t idx) { | ||
| if (!m_base) | ||
| return lldb::ValueObjectSP(); | ||
|
|
||
| uint64_t offset = idx * m_element_size_size_t; | ||
| offset = offset + m_start->GetValueAsUnsigned(0); | ||
|
|
||
| lldb::ValueObjectSP indirect = CreateValueObjectFromAddress( | ||
| "", offset, m_backend.GetExecutionContextRef(), m_element_type_size_t); | ||
| if (!indirect) | ||
| return lldb::ValueObjectSP(); | ||
|
|
||
| const size_t value = indirect->GetValueAsUnsigned(0); | ||
| if (!value) | ||
| return lldb::ValueObjectSP(); | ||
|
|
||
| offset = value * m_element_size; | ||
| offset = offset + m_base->GetValueAsUnsigned(0); | ||
|
|
||
| StreamString name; | ||
| name.Printf("[%" PRIu64 "] -> [%zu]", (uint64_t)idx, value); | ||
| return CreateValueObjectFromAddress(name.GetString(), offset, | ||
| m_backend.GetExecutionContextRef(), | ||
| m_element_type); | ||
| } | ||
|
|
||
| lldb::ChildCacheState | ||
| lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::Update() { | ||
| m_base = nullptr; | ||
| m_start = nullptr; | ||
| m_finish = nullptr; | ||
|
|
||
| CompilerType type = m_backend.GetCompilerType(); | ||
| if (type.GetNumTemplateArguments() == 0) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| m_element_type = type.GetTypeTemplateArgument(0); | ||
| if (std::optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) | ||
| m_element_size = *size; | ||
|
|
||
| if (m_element_size == 0) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| ValueObjectSP vector = m_backend.GetChildMemberWithName("__1d_"); | ||
| if (!vector) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| type = vector->GetCompilerType(); | ||
| if (type.GetNumTemplateArguments() == 0) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| m_element_type_size_t = type.GetTypeTemplateArgument(0); | ||
| if (std::optional<uint64_t> size = m_element_type_size_t.GetByteSize(nullptr)) | ||
| m_element_size_size_t = *size; | ||
|
|
||
| if (m_element_size_size_t == 0) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| ValueObjectSP base = m_backend.GetChildMemberWithName("__vp_"); | ||
| ValueObjectSP start = vector->GetChildMemberWithName("__begin_"); | ||
| ValueObjectSP finish = vector->GetChildMemberWithName("__end_"); | ||
| if (!base || !start || !finish) | ||
| return ChildCacheState::eRefetch; | ||
|
|
||
| m_base = base.get(); | ||
| m_start = start.get(); | ||
| m_finish = finish.get(); | ||
|
|
||
| return ChildCacheState::eRefetch; | ||
| } | ||
|
|
||
| bool lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd:: | ||
| MightHaveChildren() { | ||
| return true; | ||
| } | ||
|
|
||
| size_t lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd:: | ||
| GetIndexOfChildWithName(ConstString name) { | ||
| if (!m_base) | ||
| return std::numeric_limits<size_t>::max(); | ||
| return ExtractIndexFromString(name.GetCString()); | ||
| } | ||
|
|
||
| lldb_private::SyntheticChildrenFrontEnd * | ||
| lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEndCreator( | ||
| CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) { | ||
| if (!valobj_sp) | ||
| return nullptr; | ||
| return new LibcxxStdProxyArraySyntheticFrontEnd(valobj_sp); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| C_SOURCES := main.c | ||
| asan: CFLAGS_EXTRAS := -fsanitize=address -g -gcolumn-info | ||
| asan: all | ||
|
|
||
| libsanitizers: CFLAGS_EXTRAS := -fsanitize=address -fsanitize-stable-abi -g -gcolumn-info | ||
| libsanitizers: all | ||
|
|
||
| include Makefile.rules |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| def no_libsanitizers(testbase): | ||
| testbase.runCmd("image list libsystem_sanitizers.dylib", check=False) | ||
| return not "libsystem_sanitizers.dylib" in testbase.res.GetOutput() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| if(LLDB_TOOL_LLDB_SERVER_BUILD) | ||
| if (NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") | ||
| add_subdirectory(lldb-server) | ||
| endif() | ||
| endif() |