diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt index 3f932b8c7fd2..e83d374f025d 100644 --- a/cross-project-tests/CMakeLists.txt +++ b/cross-project-tests/CMakeLists.txt @@ -12,12 +12,19 @@ add_llvm_executable(check-gdb-llvm-support ) target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport) +add_executable(check-lldb-llvm-support-arrayref + debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp +) +target_link_libraries(check-lldb-llvm-support-arrayref PRIVATE LLVMSupport) +target_compile_options(check-lldb-llvm-support-arrayref PRIVATE -g -O0) + set(CROSS_PROJECT_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CROSS_PROJECT_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CROSS_PROJECT_TEST_DEPS FileCheck check-gdb-llvm-support + check-lldb-llvm-support-arrayref count llvm-ar llvm-config diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp new file mode 100644 index 000000000000..7f93aa08615d --- /dev/null +++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp @@ -0,0 +1,8 @@ +#include "llvm/ADT/ArrayRef.h" + +int Array[] = {1, 2, 3}; + +llvm::ArrayRef ArrayRef(Array); +llvm::MutableArrayRef MutableArrayRef(Array); + +int main() { return 0; } diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.test b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.test new file mode 100644 index 000000000000..0ee3b38ed3f3 --- /dev/null +++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.test @@ -0,0 +1,25 @@ +# RUN: split-file %s %t +# RUN: lldb -b -x -o 'command script import %llvm_src_root/utils/lldbDataFormatters.py' -s %t/commands.input %llvm_tools_dir/check-lldb-llvm-support-arrayref | FileCheck %t/checks + +#--- commands.input +b main +run +p ArrayRef +p MutableArrayRef + +#--- checks +# CHECK: (lldb) p ArrayRef +# CHECK-NEXT: (llvm::ArrayRef) size=3 { +# CHECK-NEXT: [0] = 1 +# CHECK-NEXT: [1] = 2 +# CHECK-NEXT: [2] = 3 +# CHECK-NEXT: } + +# CHECK: (lldb) p MutableArrayRef +# CHECK-NEXT: (llvm::MutableArrayRef) { +# CHECK-NEXT: llvm::ArrayRef = size=3 { +# CHECK-NEXT: [0] = 1 +# CHECK-NEXT: [1] = 2 +# CHECK-NEXT: [2] = 3 +# CHECK-NEXT: } +# CHECK-NEXT: } diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/lit.local.cfg b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/lit.local.cfg new file mode 100644 index 000000000000..7d787e012756 --- /dev/null +++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/lit.local.cfg @@ -0,0 +1,6 @@ +import lit.util + +if "native" not in config.available_features or lit.util.which("lldb") is None: + config.unsupported = True + +config.suffixes = [".test"]