[Lldb-commits] [lldb] Fix single thread stepping timeout race condition (PR #104195)
Endilll wrote: FYI there was a Linux pre-commit CI build recently that timed out on `functionalities/single-thread-step/TestSingleThreadStepTimeout.py`: https://buildkite.com/llvm-project/github-pull-requests/builds/91810 Relevant part of the log: https://gist.github.com/Endilll/a15335f75f2aa4b211c0b2181b25ff8f https://github.com/llvm/llvm-project/pull/104195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/Interpreter] Discard ScriptedThreadPlan::GetStopDescription return value (PR #96985)
@@ -106,10 +106,13 @@ ScriptInterpreter::GetOpaqueTypeFromSBEvent(const lldb::SBEvent &event) const { return event.m_opaque_ptr; } -Stream *ScriptInterpreter::GetOpaqueTypeFromSBStream( +lldb::StreamSP ScriptInterpreter::GetOpaqueTypeFromSBStream( const lldb::SBStream &stream) const { - if (stream.m_opaque_up) -return const_cast(stream).m_opaque_up.get(); + if (stream.m_opaque_up) { +lldb::StreamSP s = std::make_shared(); +*s << const_cast(stream).GetData(); Endilll wrote: I think this is what broke my linux build with the following linker error: ``` mold: error: undefined symbol: lldb::SBStream::GetData() >>> referenced by ScriptInterpreter.cpp >>> >>> lib/liblldbInterpreter.a(ScriptInterpreter.cpp.o):(lldb_private::ScriptInterpreter::GetOpaqueTypeFromSBStream(lldb::SBStream >>> const&) const) ``` lld complains in the same way. https://github.com/llvm/llvm-project/pull/96985 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Disable MD5 test for old versions of Visual Studio (PR #94325)
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/94325 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: Yes, some try_compile checks where replaced with a check for `CMAKE_CXX_COMPILER_ID`, so it's crucial for it to reflect the reality. https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add Python requirements.txt for test suite (PR #94220)
https://github.com/Endilll approved this pull request. https://github.com/llvm/llvm-project/pull/94220 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add Python requirements.txt for test suite (PR #94220)
Endilll wrote: > I've not been able to find what versioning scheme these 2 packages use, so > I'm not sure what versions to put here if any. > > Currently Linaro has: psutil==5.9.4 on Windows psutil == 5.9.8 on Linux > pexpect==4.9.0 on Linux > > I don't think it needs to be `==`, but maybe pinning to a version that won't > break API? If the projects have such a thing of course. > > This is initially for Github CI, so we could just use the Linux versions. I think you can list them as minimal required versions for now. https://github.com/llvm/llvm-project/pull/94220 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: @vvereschaka Thank you for letting me know! I wonder how this got past our pre- and post-commit CI, because we do build lldb with MSVC there. You fix makes total sense, so I applied it. https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cd676e5 - [lldb] Guard some GCC-style flags from MSVC
Author: Vlad Serebrennikov Date: 2024-06-01T12:48:12+03:00 New Revision: cd676e5b27cb985697deac052c797057f5a33c06 URL: https://github.com/llvm/llvm-project/commit/cd676e5b27cb985697deac052c797057f5a33c06 DIFF: https://github.com/llvm/llvm-project/commit/cd676e5b27cb985697deac052c797057f5a33c06.diff LOG: [lldb] Guard some GCC-style flags from MSVC A follow up to #92953. Suggested in https://github.com/llvm/llvm-project/pull/92953#issuecomment-2143274065 Added: Modified: lldb/cmake/modules/LLDBConfig.cmake Removed: diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index f2afced7403bd..a60921990cf77 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -186,13 +186,15 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") # printed. Therefore, check for whether the compiler supports options in the # form -W, and if supported, add the corresponding -Wno- option. -# Disable GCC warnings -append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) -append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) -append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) -append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) +if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + # Disable GCC warnings + append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) + append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) + append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) + + check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) + append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) +endif() # Disable Clang warnings if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: I think the issue is that we no longer passed `-fno-lifetime-dse` to GCC due to incorrect condition (my fault), which caused some downstream LTO crashes as reported by @mveriksson in https://github.com/llvm/llvm-project/commit/4feae05c6abda364a9295aecfa600d7d4e7dfeb6#r142466703 (thank you very much!). Regressions from fixing it align with the unexpected improvements reporter earlier https://llvm-compile-time-tracker.com/compare.php?from=4bce270157f9a81bd7e38dc589a2970a445d1e96&to=b7f95171c8bf8e5a12a9e185c063ed85cd9dc8ee&stat=instructions:u https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: > FYI this causes a minor compile-time improvement in stage1 builds using gcc: > https://llvm-compile-time-tracker.com/compare.php?from=32c3561d44aa792ef08d72b5a4c342c9965bc4c2&to=4feae05c6abda364a9295aecfa600d7d4e7dfeb6&stat=instructions:u > While that's nice, it does suggest that the flags are not the same as before. @nikic Can you elaborate on those numbers? Do you say that Clang (compiled with GCC) which compiles those tests works faster now? https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: Quite expectedly, I see buildbot failures. Working on them. https://lab.llvm.org/buildbot/#/builders/36/builds/45836 https://lab.llvm.org/buildbot/#/builders/57/builds/35200 https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/92953 >From 66e05ac24613435dbe774d49684d8ff9d119c4c3 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 21 May 2024 21:41:24 +0300 Subject: [PATCH 1/3] Remove some `try_compile` CMake checks for compiler flags This patch remove 36 checks for compiler flags that are done via invoking the compiler across LLVM, Clang, and LLDB. It's was made possible by raising the bar for supported compilers that has been happening over the years since the checks were added. This is going to improve CMake configuration times. This topic was highlighted in https://discourse.llvm.org/t/cmake-compiler-flag-checks-are-really-slow-ideas-to-speed-them-up/78882. --- clang/CMakeLists.txt | 5 +- .../tests/functional/exec/CMakeLists.txt | 6 +- lldb/cmake/modules/LLDBConfig.cmake | 20 +-- llvm/cmake/config-ix.cmake| 19 +-- llvm/cmake/modules/AddLLVM.cmake | 4 +- llvm/cmake/modules/HandleLLVMOptions.cmake| 142 -- third-party/unittest/CMakeLists.txt | 4 +- 7 files changed, 80 insertions(+), 120 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index c20ce47a12abb..a6bcb853a464c 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -349,10 +349,7 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long") endif () - check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) - if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG ) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) endif () # Determine HOST_LINK_VERSION on Darwin. diff --git a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt index 95c6fdb610e0f..cb6ebda183725 100644 --- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt +++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt @@ -2,11 +2,7 @@ project(exec C) cmake_minimum_required(VERSION 3.20.0) -include(CheckCCompilerFlag) -check_c_compiler_flag("-std=c99" C99_SUPPORTED) -if (C99_SUPPORTED) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") include(CheckFunctionExists) include(CheckSymbolExists) diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 3c6223b015bb1..6458f2e174643 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -187,24 +187,18 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") # form -W, and if supported, add the corresponding -Wno- option. # Disable GCC warnings -check_cxx_compiler_flag("-Wdeprecated-declarations" CXX_SUPPORTS_DEPRECATED_DECLARATIONS) -append_if(CXX_SUPPORTS_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wunknown-pragmas" CXX_SUPPORTS_UNKNOWN_PRAGMAS) -append_if(CXX_SUPPORTS_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wstrict-aliasing" CXX_SUPPORTS_STRICT_ALIASING) -append_if(CXX_SUPPORTS_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) +append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) +append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) +append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) # Disable Clang warnings -check_cxx_compiler_flag("-Wdeprecated-register" CXX_SUPPORTS_DEPRECATED_REGISTER) -append_if(CXX_SUPPORTS_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wvla-extension" CXX_SUPPORTS_VLA_EXTENSION) -append_if(CXX_SUPPORTS_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + append("-Wno-deprecated-register" CMAKE_CXX_FLAGS) + append("-Wno-vla-extension" CMAKE_CXX_FLAGS) +endif() # Disable MSVC warnings if( MSVC ) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index bf1b110245bb2..0900e1107076e 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -415,15 +415,14 @@ if( LLVM_ENABLE_PIC ) set(ENABLE_PIC 1) else() set(ENABLE_PIC 0) - check_cxx_compiler_flag("-fno-pie" SUPPORTS_NO_PIE_FLAG) - if(SUPPORTS_NO_PIE_FLAG) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie") - endif() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie") endif() -check_cxx_compiler_flag("-Wvariadic-macros" SUPPORTS_VARIADIC_MACROS_FLAG) -check_cxx_compiler_flag("-Wgnu-zero-variadic-macro-arguments" -SUPPORTS_GNU_ZERO_VA
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/92953 >From 66e05ac24613435dbe774d49684d8ff9d119c4c3 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 21 May 2024 21:41:24 +0300 Subject: [PATCH 1/2] Remove some `try_compile` CMake checks for compiler flags This patch remove 36 checks for compiler flags that are done via invoking the compiler across LLVM, Clang, and LLDB. It's was made possible by raising the bar for supported compilers that has been happening over the years since the checks were added. This is going to improve CMake configuration times. This topic was highlighted in https://discourse.llvm.org/t/cmake-compiler-flag-checks-are-really-slow-ideas-to-speed-them-up/78882. --- clang/CMakeLists.txt | 5 +- .../tests/functional/exec/CMakeLists.txt | 6 +- lldb/cmake/modules/LLDBConfig.cmake | 20 +-- llvm/cmake/config-ix.cmake| 19 +-- llvm/cmake/modules/AddLLVM.cmake | 4 +- llvm/cmake/modules/HandleLLVMOptions.cmake| 142 -- third-party/unittest/CMakeLists.txt | 4 +- 7 files changed, 80 insertions(+), 120 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index c20ce47a12abb..a6bcb853a464c 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -349,10 +349,7 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long") endif () - check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) - if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG ) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) endif () # Determine HOST_LINK_VERSION on Darwin. diff --git a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt index 95c6fdb610e0f..cb6ebda183725 100644 --- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt +++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt @@ -2,11 +2,7 @@ project(exec C) cmake_minimum_required(VERSION 3.20.0) -include(CheckCCompilerFlag) -check_c_compiler_flag("-std=c99" C99_SUPPORTED) -if (C99_SUPPORTED) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") include(CheckFunctionExists) include(CheckSymbolExists) diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 3c6223b015bb1..6458f2e174643 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -187,24 +187,18 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") # form -W, and if supported, add the corresponding -Wno- option. # Disable GCC warnings -check_cxx_compiler_flag("-Wdeprecated-declarations" CXX_SUPPORTS_DEPRECATED_DECLARATIONS) -append_if(CXX_SUPPORTS_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wunknown-pragmas" CXX_SUPPORTS_UNKNOWN_PRAGMAS) -append_if(CXX_SUPPORTS_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wstrict-aliasing" CXX_SUPPORTS_STRICT_ALIASING) -append_if(CXX_SUPPORTS_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) +append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) +append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) +append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) # Disable Clang warnings -check_cxx_compiler_flag("-Wdeprecated-register" CXX_SUPPORTS_DEPRECATED_REGISTER) -append_if(CXX_SUPPORTS_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wvla-extension" CXX_SUPPORTS_VLA_EXTENSION) -append_if(CXX_SUPPORTS_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + append("-Wno-deprecated-register" CMAKE_CXX_FLAGS) + append("-Wno-vla-extension" CMAKE_CXX_FLAGS) +endif() # Disable MSVC warnings if( MSVC ) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index bf1b110245bb2..0900e1107076e 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -415,15 +415,14 @@ if( LLVM_ENABLE_PIC ) set(ENABLE_PIC 1) else() set(ENABLE_PIC 0) - check_cxx_compiler_flag("-fno-pie" SUPPORTS_NO_PIE_FLAG) - if(SUPPORTS_NO_PIE_FLAG) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie") - endif() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie") endif() -check_cxx_compiler_flag("-Wvariadic-macros" SUPPORTS_VARIADIC_MACROS_FLAG) -check_cxx_compiler_flag("-Wgnu-zero-variadic-macro-arguments" -SUPPORTS_GNU_ZERO_VA
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: Here are CE links with the set of minimum required compilers that should cover almost all the changes I made: https://godbolt.org/z/j98xzhrGa https://godbolt.org/z/errv4WhfP https://godbolt.org/z/vnoh8YqEP Windows-targeted flags were tested both on MSVC on CE, and on clang-cl 5.0 locally. https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
Endilll wrote: On my setup, this patch improves CMake configuration times (from a clean state) from 51 seconds down to 46 seconds (average of 3 measurements). My setup: ancient x86 hardware, Debian Sid, nightly Clang, build directory on a RAM disk. CMake invocation: `cmake -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_RUNTIMES="libunwind;libcxx;libcxxabi" -DCMAKE_BUILD_TYPE=Debug -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_DOXYGEN=ON -DLLVM_ENABLE_LIBCXX=ON -DBUILD_SHARED_LIBS=ON -DLLDB_ENABLE_PYTHON=ON ~/endill/llvm-project/llvm`. https://github.com/llvm/llvm-project/pull/92953 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/92953 This patch remove 36 checks for compiler flags that are done via invoking the compiler across LLVM, Clang, and LLDB. It's was made possible by raising the bar for supported compilers that has been happening over the years since the checks were added. This is going to improve CMake configuration times. This topic was highlighted in https://discourse.llvm.org/t/cmake-compiler-flag-checks-are-really-slow-ideas-to-speed-them-up/78882. >From 66e05ac24613435dbe774d49684d8ff9d119c4c3 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 21 May 2024 21:41:24 +0300 Subject: [PATCH] Remove some `try_compile` CMake checks for compiler flags This patch remove 36 checks for compiler flags that are done via invoking the compiler across LLVM, Clang, and LLDB. It's was made possible by raising the bar for supported compilers that has been happening over the years since the checks were added. This is going to improve CMake configuration times. This topic was highlighted in https://discourse.llvm.org/t/cmake-compiler-flag-checks-are-really-slow-ideas-to-speed-them-up/78882. --- clang/CMakeLists.txt | 5 +- .../tests/functional/exec/CMakeLists.txt | 6 +- lldb/cmake/modules/LLDBConfig.cmake | 20 +-- llvm/cmake/config-ix.cmake| 19 +-- llvm/cmake/modules/AddLLVM.cmake | 4 +- llvm/cmake/modules/HandleLLVMOptions.cmake| 142 -- third-party/unittest/CMakeLists.txt | 4 +- 7 files changed, 80 insertions(+), 120 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index c20ce47a12abb..a6bcb853a464c 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -349,10 +349,7 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long") endif () - check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) - if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG ) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) endif () # Determine HOST_LINK_VERSION on Darwin. diff --git a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt index 95c6fdb610e0f..cb6ebda183725 100644 --- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt +++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt @@ -2,11 +2,7 @@ project(exec C) cmake_minimum_required(VERSION 3.20.0) -include(CheckCCompilerFlag) -check_c_compiler_flag("-std=c99" C99_SUPPORTED) -if (C99_SUPPORTED) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") include(CheckFunctionExists) include(CheckSymbolExists) diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 3c6223b015bb1..6458f2e174643 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -187,24 +187,18 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") # form -W, and if supported, add the corresponding -Wno- option. # Disable GCC warnings -check_cxx_compiler_flag("-Wdeprecated-declarations" CXX_SUPPORTS_DEPRECATED_DECLARATIONS) -append_if(CXX_SUPPORTS_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wunknown-pragmas" CXX_SUPPORTS_UNKNOWN_PRAGMAS) -append_if(CXX_SUPPORTS_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wstrict-aliasing" CXX_SUPPORTS_STRICT_ALIASING) -append_if(CXX_SUPPORTS_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) +append("-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) +append("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) +append("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) check_cxx_compiler_flag("-Wstringop-truncation" CXX_SUPPORTS_STRINGOP_TRUNCATION) append_if(CXX_SUPPORTS_STRINGOP_TRUNCATION "-Wno-stringop-truncation" CMAKE_CXX_FLAGS) # Disable Clang warnings -check_cxx_compiler_flag("-Wdeprecated-register" CXX_SUPPORTS_DEPRECATED_REGISTER) -append_if(CXX_SUPPORTS_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) - -check_cxx_compiler_flag("-Wvla-extension" CXX_SUPPORTS_VLA_EXTENSION) -append_if(CXX_SUPPORTS_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + append("-Wno-deprecated-register" CMAKE_CXX_FLAGS) + append("-Wno-vla-extension" CMAKE_CXX_FLAGS) +endif() # Disable MSVC warnings if( MSVC ) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index bf1b110245bb2..0900e1107076e 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -415,15 +415,14 @@ if( LLVM_ENABLE_PIC ) set(ENABLE_PIC 1) else() set(ENABLE_P
[Lldb-commits] [lldb] [lldb] Add ability to show enum as name and value at the same time (PR #90059)
Endilll wrote: > For me the picture is limited to register printing. I'll be setting this new > option on the register type when printing > (https://github.com/DavidSpickett/llvm-project/commit/24dbefaa14030646ba0871298989558221af1ba0#diff-18135f619417bbaa1ab0c181ce55b2c55681323c06e90fa1a3e16099c7176e21). > So only from C++ for now. So it's hard-coded, I see. > What is a flag like enum? `enum { a = 1, b = 2, c = 4, d = 8}` — this sort of enumeration. Sorry if my terminology was confusing. They are handled further in `DumpEnumValue()`, after the changes you've made here, and called bit-fields in the comments. https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add ability to show enum as name and value at the same time (PR #90059)
Endilll wrote: I'm excited so see changes in this area! > It is a subset of https://github.com/llvm/llvm-project/pull/69815, only for > use by register printing (ping @Endilll). Yeah, that effort is stalled because I don't see a clear path forward there, and I'm lacking energy to find and push for one. I guess I can try to piggyback on this PR if it goes in the direction I need (I hope you don't mind :). Seriously, though, I'm not sure how your design with a flag orthogonal to format fares in the feedback I was given back then. It's also not clear how this new "presentation mode" is going to be controlled. While it's not in the scope of this PR, it would be nice if you can share a bigger picture. Another thing this PR doesn't seem to touch is flag-like enums. Even if you don't want to add a numerical value there, because it'd be too much information to present, it still would be nice to see it explicitly considered. https://github.com/llvm/llvm-project/pull/90059 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)
Endilll wrote: @Michael137 suggested that I check that performance of `FindDirectNestedType` doesn't regress (at least for my use case), since I have custom instrumentation in my formatter. I can confirm that 3 versions of this function (#68705, #74786, and this PR) exhibit the same level of performance. Raw numbers fluctuate a lot, but I don't see anything concerning: ``` This PR --- 2,611,025 1,988,893 2,878,981 1,873,220 main branch (#74786) 1,973,071 2,542,073 1,509,624 Initial implementation (#68705) -- 2,029,233 2,477,041 1,315,462 ``` https://github.com/llvm/llvm-project/pull/89183 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make SBType::FindDirectNestedType work with expression ASTs (PR #89183)
Endilll wrote: > One thing I'd like to get feedback on is whether this should be looking into > base classes. The discussion on the original PR focuses on lexically nested > types, but going through base classes (following usual language rules) is > another form of nesting. Both the existing and the new implementations don't > do that, but I think it would be more natural to do it. Of course, then the > function can definitely return more than one result... What you're describing here is in line with member lookup described in the Standard. While it might be a useful facility, it's at odds with the intent of `FindDirectNestedTypes()` to be a small building block for efficient AST traversal. For the use case I have for this function, any amount of lookup is going to regress the performance of the formatter, and subsequently responsiveness of the debugger. So if you're going to pursue this, I suggest exposing this as a new function. https://github.com/llvm/llvm-project/pull/89183 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4214f25 - Re-land "[lldb] Fix `FindDirectNestedType` not working with class templates (#81666)"
Author: Vlad Serebrennikov Date: 2024-02-16T22:47:09+03:00 New Revision: 4214f25dccba36472c9666f1395eef894dca1bba URL: https://github.com/llvm/llvm-project/commit/4214f25dccba36472c9666f1395eef894dca1bba DIFF: https://github.com/llvm/llvm-project/commit/4214f25dccba36472c9666f1395eef894dca1bba.diff LOG: Re-land "[lldb] Fix `FindDirectNestedType` not working with class templates (#81666)" This patch attempts to fix lookup in class template specialization. The first fixed problem is that during type lookup `DeclContextGetName` have been dropping template arguments. So when such a name was compared against a name in `DW_AT_name`, which contains template arguments, false mismatches have been occurring. The second fixed problem is that LLDB's printing policy hasn't been matching Clang's printing policy when it comes to integral non-type template arguments. This again caused some false mismatches during type lookup, because Clang puts e.g. `3U` in debug info for class specializations, but LLDB has been expecting just `3`. This patch brings printing policy in line with what Clang does. Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/test/API/python_api/type/TestTypeList.py lldb/test/API/python_api/type/main.cpp Removed: diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index a41e2c690853d2..51ab13108feb3a 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9265,8 +9265,14 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); -if (named_decl) - return ConstString(named_decl->getName()); +if (named_decl) { + std::string name; + llvm::raw_string_ostream stream{name}; + auto policy = GetTypePrintingPolicy(); + policy.AlwaysIncludeTypeForTemplateArgument = true; + named_decl->getNameForDiagnostic(stream, policy, /*qualified=*/false); + return ConstString(name); +} } return ConstString(); } diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index c267defb58edf9..63ab958193574b 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -150,6 +150,23 @@ def test(self): invalid_type = task_type.FindDirectNestedType(None) self.assertFalse(invalid_type) +# Check that FindDirectNestedType works with types from AST +pointer = frame0.FindVariable("pointer") +pointer_type = pointer.GetType() +self.assertTrue(pointer_type) +self.DebugSBType(pointer_type) +pointer_info_type = pointer_type.template_args[1] +self.assertTrue(pointer_info_type) +self.DebugSBType(pointer_info_type) + +pointer_masks1_type = pointer_info_type.FindDirectNestedType("Masks1") +self.assertTrue(pointer_masks1_type) +self.DebugSBType(pointer_masks1_type) + +pointer_masks2_type = pointer_info_type.FindDirectNestedType("Masks2") +self.assertTrue(pointer_masks2_type) +self.DebugSBType(pointer_masks2_type) + # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName("id") self.DebugSBValue(id) diff --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp index 98de9707d88654..391f58e3e5871c 100644 --- a/lldb/test/API/python_api/type/main.cpp +++ b/lldb/test/API/python_api/type/main.cpp @@ -34,6 +34,14 @@ class Task { {} }; +template struct PointerInfo { + enum Masks1 { pointer_mask }; + enum class Masks2 { pointer_mask }; +}; + +template > +struct Pointer {}; + enum EnumType {}; enum class ScopedEnumType {}; enum class EnumUChar : unsigned char {}; @@ -71,5 +79,9 @@ int main (int argc, char const *argv[]) ScopedEnumType scoped_enum_type; EnumUChar scoped_enum_type_uchar; +Pointer<3> pointer; +PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask; +PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask; + return 0; // Break at this line } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
Endilll wrote: I'd appreciate if you gave me a slightly bit more time, because I've been testing the fix locally in the meantime. https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
Endilll wrote: @JDevlieghere I have an idea what have caused this failure, but I guess I have to enable libcxx to replicate it locally. https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
Endilll wrote: Trying to take a look, but https://green.lab.llvm.org is extraordinary slow for me. https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll ready_for_review https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
@@ -150,6 +150,23 @@ def test(self): invalid_type = task_type.FindDirectNestedType(None) self.assertFalse(invalid_type) +# Check that FindDirectNestedType works with types from AST +pointer = frame0.FindVariable("pointer") +pointer_type = pointer.GetType() +self.assertTrue(pointer_type) +self.DebugSBType(pointer_type) +pointer_info_type = pointer_type.template_args[0] Endilll wrote: You're absolutely right. Thank you! https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/81666 >From bf92dc89858668518a5d842eac34bdf1b3eaade2 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 14 Feb 2024 00:26:09 +0300 Subject: [PATCH 1/3] [lldb] Fix `FindDirectNestedType` not working with class templates This patch attempts to fix lookup in class template specialization that have an integral non-type template parameter of non-int type. unsigned 3 might be printed as `3` or `3U` depending on PrintingPolicy. This patch bring it in line with what Clang does (which addes the suffix). --- .../TypeSystem/Clang/TypeSystemClang.cpp| 9 +++-- lldb/test/API/python_api/type/TestTypeList.py | 17 + lldb/test/API/python_api/type/main.cpp | 13 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index a41e2c690853d2..e6a9d3f4f02836 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2165,6 +2165,7 @@ PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() { // (and we then would have suppressed them from the type name) and also setups // where LLDB wasn't able to reconstruct the default arguments. printing_policy.SuppressDefaultTemplateArgs = false; + printing_policy.AlwaysIncludeTypeForTemplateArgument = true; return printing_policy; } @@ -9265,8 +9266,12 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); -if (named_decl) - return ConstString(named_decl->getName()); +if (named_decl) { + std::string name; + llvm::raw_string_ostream stream{name}; + named_decl->getNameForDiagnostic(stream, GetTypePrintingPolicy(), /*qualified=*/ false); + return ConstString(name); +} } return ConstString(); } diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index c267defb58edf9..f874e87771c624 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -150,6 +150,23 @@ def test(self): invalid_type = task_type.FindDirectNestedType(None) self.assertFalse(invalid_type) +# Check that FindDirectNestedType works with types from AST +pointer = frame0.FindVariable("pointer") +pointer_type = pointer.GetType() +self.assertTrue(pointer_type) +self.DebugSBType(pointer_type) +pointer_info_type = pointer_type.template_args[0] +self.assertTrue(pointer_info_type) +self.DebugSBType(pointer_info_type) + +pointer_masks1_type = pointer_info_type.FindDirectNestedType("Masks1") +self.assertTrue(pointer_masks1_type) +self.DebugSBType(pointer_masks1_type) + +pointer_masks2_type = pointer_info_type.FindDirectNestedType("Masks2") +self.assertTrue(pointer_masks2_type) +self.DebugSBType(pointer_masks2_type) + # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName("id") self.DebugSBValue(id) diff --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp index 98de9707d88654..b587acdd96c590 100644 --- a/lldb/test/API/python_api/type/main.cpp +++ b/lldb/test/API/python_api/type/main.cpp @@ -34,6 +34,15 @@ class Task { {} }; +template +struct PointerInfo { + enum Masks1 { pointer_mask }; + enum class Masks2 { pointer_mask }; +}; + +template > +struct Pointer {}; + enum EnumType {}; enum class ScopedEnumType {}; enum class EnumUChar : unsigned char {}; @@ -71,5 +80,9 @@ int main (int argc, char const *argv[]) ScopedEnumType scoped_enum_type; EnumUChar scoped_enum_type_uchar; +Pointer<3> pointer; +PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask; +PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask; + return 0; // Break at this line } >From 153c8ec6abda4315c5bce6d088513a6ff63f26f9 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 14 Feb 2024 00:33:17 +0300 Subject: [PATCH 2/3] Run clang-format --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 ++- lldb/test/API/python_api/type/main.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index e6a9d3f4f02836..0652ac0e134f53 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9269,7 +9269,8 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ct
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
Endilll wrote: This PR is a draft because new test, which is simplified `llvm::PointerIntPair` and `llvm::PointerIntPairInfo`, doesn't pass even with the proposed fix. https://github.com/llvm/llvm-project/pull/81666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/81666 >From bf92dc89858668518a5d842eac34bdf1b3eaade2 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 14 Feb 2024 00:26:09 +0300 Subject: [PATCH 1/2] [lldb] Fix `FindDirectNestedType` not working with class templates This patch attempts to fix lookup in class template specialization that have an integral non-type template parameter of non-int type. unsigned 3 might be printed as `3` or `3U` depending on PrintingPolicy. This patch bring it in line with what Clang does (which addes the suffix). --- .../TypeSystem/Clang/TypeSystemClang.cpp| 9 +++-- lldb/test/API/python_api/type/TestTypeList.py | 17 + lldb/test/API/python_api/type/main.cpp | 13 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index a41e2c690853d2..e6a9d3f4f02836 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2165,6 +2165,7 @@ PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() { // (and we then would have suppressed them from the type name) and also setups // where LLDB wasn't able to reconstruct the default arguments. printing_policy.SuppressDefaultTemplateArgs = false; + printing_policy.AlwaysIncludeTypeForTemplateArgument = true; return printing_policy; } @@ -9265,8 +9266,12 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); -if (named_decl) - return ConstString(named_decl->getName()); +if (named_decl) { + std::string name; + llvm::raw_string_ostream stream{name}; + named_decl->getNameForDiagnostic(stream, GetTypePrintingPolicy(), /*qualified=*/ false); + return ConstString(name); +} } return ConstString(); } diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index c267defb58edf9..f874e87771c624 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -150,6 +150,23 @@ def test(self): invalid_type = task_type.FindDirectNestedType(None) self.assertFalse(invalid_type) +# Check that FindDirectNestedType works with types from AST +pointer = frame0.FindVariable("pointer") +pointer_type = pointer.GetType() +self.assertTrue(pointer_type) +self.DebugSBType(pointer_type) +pointer_info_type = pointer_type.template_args[0] +self.assertTrue(pointer_info_type) +self.DebugSBType(pointer_info_type) + +pointer_masks1_type = pointer_info_type.FindDirectNestedType("Masks1") +self.assertTrue(pointer_masks1_type) +self.DebugSBType(pointer_masks1_type) + +pointer_masks2_type = pointer_info_type.FindDirectNestedType("Masks2") +self.assertTrue(pointer_masks2_type) +self.DebugSBType(pointer_masks2_type) + # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName("id") self.DebugSBValue(id) diff --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp index 98de9707d88654..b587acdd96c590 100644 --- a/lldb/test/API/python_api/type/main.cpp +++ b/lldb/test/API/python_api/type/main.cpp @@ -34,6 +34,15 @@ class Task { {} }; +template +struct PointerInfo { + enum Masks1 { pointer_mask }; + enum class Masks2 { pointer_mask }; +}; + +template > +struct Pointer {}; + enum EnumType {}; enum class ScopedEnumType {}; enum class EnumUChar : unsigned char {}; @@ -71,5 +80,9 @@ int main (int argc, char const *argv[]) ScopedEnumType scoped_enum_type; EnumUChar scoped_enum_type_uchar; +Pointer<3> pointer; +PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask; +PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask; + return 0; // Break at this line } >From 153c8ec6abda4315c5bce6d088513a6ff63f26f9 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 14 Feb 2024 00:33:17 +0300 Subject: [PATCH 2/2] Run clang-format --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 ++- lldb/test/API/python_api/type/main.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index e6a9d3f4f02836..0652ac0e134f53 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9269,7 +9269,8 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ct
[Lldb-commits] [lldb] [lldb] Fix `FindDirectNestedType` not working with class templates (PR #81666)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/81666 This patch attempts to fix lookup in class template specialization that have an integral non-type template parameter of non-int type. unsigned 3 might be printed as `3` or `3U` depending on PrintingPolicy. This patch bring it in line with what Clang does (which addes the suffix). >From bf92dc89858668518a5d842eac34bdf1b3eaade2 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 14 Feb 2024 00:26:09 +0300 Subject: [PATCH] [lldb] Fix `FindDirectNestedType` not working with class templates This patch attempts to fix lookup in class template specialization that have an integral non-type template parameter of non-int type. unsigned 3 might be printed as `3` or `3U` depending on PrintingPolicy. This patch bring it in line with what Clang does (which addes the suffix). --- .../TypeSystem/Clang/TypeSystemClang.cpp| 9 +++-- lldb/test/API/python_api/type/TestTypeList.py | 17 + lldb/test/API/python_api/type/main.cpp | 13 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index a41e2c690853d2..e6a9d3f4f02836 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2165,6 +2165,7 @@ PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() { // (and we then would have suppressed them from the type name) and also setups // where LLDB wasn't able to reconstruct the default arguments. printing_policy.SuppressDefaultTemplateArgs = false; + printing_policy.AlwaysIncludeTypeForTemplateArgument = true; return printing_policy; } @@ -9265,8 +9266,12 @@ ConstString TypeSystemClang::DeclContextGetName(void *opaque_decl_ctx) { if (opaque_decl_ctx) { clang::NamedDecl *named_decl = llvm::dyn_cast((clang::DeclContext *)opaque_decl_ctx); -if (named_decl) - return ConstString(named_decl->getName()); +if (named_decl) { + std::string name; + llvm::raw_string_ostream stream{name}; + named_decl->getNameForDiagnostic(stream, GetTypePrintingPolicy(), /*qualified=*/ false); + return ConstString(name); +} } return ConstString(); } diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index c267defb58edf9..f874e87771c624 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -150,6 +150,23 @@ def test(self): invalid_type = task_type.FindDirectNestedType(None) self.assertFalse(invalid_type) +# Check that FindDirectNestedType works with types from AST +pointer = frame0.FindVariable("pointer") +pointer_type = pointer.GetType() +self.assertTrue(pointer_type) +self.DebugSBType(pointer_type) +pointer_info_type = pointer_type.template_args[0] +self.assertTrue(pointer_info_type) +self.DebugSBType(pointer_info_type) + +pointer_masks1_type = pointer_info_type.FindDirectNestedType("Masks1") +self.assertTrue(pointer_masks1_type) +self.DebugSBType(pointer_masks1_type) + +pointer_masks2_type = pointer_info_type.FindDirectNestedType("Masks2") +self.assertTrue(pointer_masks2_type) +self.DebugSBType(pointer_masks2_type) + # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName("id") self.DebugSBValue(id) diff --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp index 98de9707d88654..b587acdd96c590 100644 --- a/lldb/test/API/python_api/type/main.cpp +++ b/lldb/test/API/python_api/type/main.cpp @@ -34,6 +34,15 @@ class Task { {} }; +template +struct PointerInfo { + enum Masks1 { pointer_mask }; + enum class Masks2 { pointer_mask }; +}; + +template > +struct Pointer {}; + enum EnumType {}; enum class ScopedEnumType {}; enum class EnumUChar : unsigned char {}; @@ -71,5 +80,9 @@ int main (int argc, char const *argv[]) ScopedEnumType scoped_enum_type; EnumUChar scoped_enum_type_uchar; +Pointer<3> pointer; +PointerInfo<3>::Masks1 mask1 = PointerInfo<3>::Masks1::pointer_mask; +PointerInfo<3>::Masks2 mask2 = PointerInfo<3>::Masks2::pointer_mask; + return 0; // Break at this line } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
Endilll wrote: > The logic is that this is a pretty big hole in our C++20 support and I don't > think it's reasonable to try a merge after the deadline for 18. WDYT? >From our past experience with release managers, they seem quite generous with >deadlines to merge stuff in, as long as maintainers agree. I think the real >question is how much time do we want this to bake in tree before users get to >see it. https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [lld] [clang] [libc] [libclc] [lldb] [llvm] [clang-tools-extra] [flang] [libcxx] [libunwind] [clang] Add tests for DRs about complete-class context (PR #77444)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/77444 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [lld] [clang] [libc] [libclc] [lldb] [llvm] [clang-tools-extra] [flang] [libcxx] [libunwind] [clang] Add tests for DRs about complete-class context (PR #77444)
Endilll wrote: CI fails on formatting in unrelated files, so I'm going to ignore it: ``` t=1704988008448 + echo '*** Checking for trailing whitespace left in Clang source files ***' t=1704988008448 *** Checking for trailing whitespace left in Clang source files *** t=1704988008448 + grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs t=1704988008595 clang/docs/HLSL/FunctionCalls.rst:147:Clang Implementation t=1704988008602 + echo '*** Trailing whitespace has been found in Clang source files as described above ***' t=1704988008602 *** Trailing whitespace has been found in Clang source files as described above *** t=1704988008602 + exit 1 t=1704988008603 ^^^ +++ t=1704988008603 Error: The command exited with status 1 t=1704988008603 ^^^ +++ t=1704988008603 user command error: exit status 1 ``` https://buildkite.com/llvm-project/github-pull-requests/builds/28418 https://github.com/llvm/llvm-project/pull/77444 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
@@ -25,7 +25,7 @@ template struct S {}; // #dr1801-S S V; // #dr1801-S-i // cxx98-14-error@-1 {{non-type template argument does not refer to any declaration}} // cxx98-14-note@#dr1801-S {{template parameter is declared here}} -// since-cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}} +// cxx17-error@#dr1801-S-i {{non-type template argument refers to subobject '.i'}} Endilll wrote: Quoting P1907R1 wording changes: > For a non-type template-parameter of reference or pointer type <...> the > reference or pointer value shall not refer to or be the address of > (respectively): > ~a subobject (6.7.2),~ > <...> > a subobject (6.7.2) of one of the above. My reading is that you indeed can reference subobjects in NTTP since 20, unless they fall into one of the narrow categories listed in that paragraph. The change you made is correct, unless P1907R1 was adopted as a DR. Sorry I forgot to check current wording when I added the test. https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
https://github.com/Endilll commented: C++ DR test changes look good to me. https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/78041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [libclc] [lldb] [libcxx] [flang] [libc] [libunwind] [lld] [clang] [clang-tools-extra] [compiler-rt] [clang] Add tests for DRs about complete-class context (PR #77444)
@@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658 C c; } +namespace dr1626 { // dr1626: no open +// FIXME: current consensus for CWG2335 is that the examples are well-formed. Endilll wrote: We had an offline discussion, and concluded that this test should be removed. https://github.com/llvm/llvm-project/pull/77444 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [compiler-rt] [libc] [libunwind] [clang-tools-extra] [libclc] [lldb] [libcxx] [llvm] [flang] [lld] [clang] Add tests for DRs about complete-class context (PR #77444)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/77444 >From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 9 Jan 2024 14:17:21 +0300 Subject: [PATCH 1/4] [clang] Add tests for DRs about complete-class context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. [Drafting note: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — end drafting note] ([class.member.lookup]/4) Complete-class context is described in [class.mem.general] [p7](http://eel.is/c++draft/class#mem.general-7) and [p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests only for CWG issues that fall under current definition of complete-class context, because I'm not sure how CWG1255 and CWG287 are going to work. That's why I skip over them, but mark CWG1308 as superseded by CWG1330. --- clang/test/CXX/drs/dr13xx.cpp | 2 ++ clang/test/CXX/drs/dr16xx.cpp | 22 clang/test/CXX/drs/dr18xx.cpp | 38 +++ clang/test/CXX/drs/dr2335.cpp | 48 +++ clang/www/cxx_dr_status.html | 8 +++--- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 clang/test/CXX/drs/dr2335.cpp diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp index 359c04b3e0f3d4..81a8a8a361700a 100644 --- a/clang/test/CXX/drs/dr13xx.cpp +++ b/clang/test/CXX/drs/dr13xx.cpp @@ -40,6 +40,8 @@ void caller() { #endif // __cplusplus >= 201103L } // namespace dr1307 +// dr1308: sup 1330 + namespace dr1310 { // dr1310: 5 struct S {} * sp = new S::S; // expected-error@-1 {{qualified reference to 'S' is a constructor name rather than a type in this context}} diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp index 3f074c4d57354a..342240cdc7a43d 100644 --- a/clang/test/CXX/drs/dr16xx.cpp +++ b/clang/test/CXX/drs/dr16xx.cpp @@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658 C c; } +namespace dr1626 { // dr1626: no open +// FIXME: current consensus for CWG2335 is that the examples are well-formed. +#if __cplusplus >= 201103L +namespace ex1 { +template struct C { + template static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); +}; +template struct C; +} // namespace ex1 + +namespace ex2 { +struct C { + static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); + // expected-error@-1 {{in-class initializer for static data member is not a constant expression}} +}; +C c; +} // namespace ex2 +#endif +} // namespace dr1626 + namespace dr1631 { // dr1631: 3.7 #if __cplusplus >= 201103L // Incorrect overload resolution for single-element initializer-list diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index fbe67bd0c2f6db..0a0213c28595fd 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcx
[Lldb-commits] [flang] [lldb] [lld] [clang] [llvm] [clang-tools-extra] [libclc] [libunwind] [libcxx] [libc] [compiler-rt] [clang] Add tests for DRs about complete-class context (PR #77444)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/77444 >From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 9 Jan 2024 14:17:21 +0300 Subject: [PATCH 1/4] [clang] Add tests for DRs about complete-class context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. [Drafting note: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — end drafting note] ([class.member.lookup]/4) Complete-class context is described in [class.mem.general] [p7](http://eel.is/c++draft/class#mem.general-7) and [p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests only for CWG issues that fall under current definition of complete-class context, because I'm not sure how CWG1255 and CWG287 are going to work. That's why I skip over them, but mark CWG1308 as superseded by CWG1330. --- clang/test/CXX/drs/dr13xx.cpp | 2 ++ clang/test/CXX/drs/dr16xx.cpp | 22 clang/test/CXX/drs/dr18xx.cpp | 38 +++ clang/test/CXX/drs/dr2335.cpp | 48 +++ clang/www/cxx_dr_status.html | 8 +++--- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 clang/test/CXX/drs/dr2335.cpp diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp index 359c04b3e0f3d4..81a8a8a361700a 100644 --- a/clang/test/CXX/drs/dr13xx.cpp +++ b/clang/test/CXX/drs/dr13xx.cpp @@ -40,6 +40,8 @@ void caller() { #endif // __cplusplus >= 201103L } // namespace dr1307 +// dr1308: sup 1330 + namespace dr1310 { // dr1310: 5 struct S {} * sp = new S::S; // expected-error@-1 {{qualified reference to 'S' is a constructor name rather than a type in this context}} diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp index 3f074c4d57354a..342240cdc7a43d 100644 --- a/clang/test/CXX/drs/dr16xx.cpp +++ b/clang/test/CXX/drs/dr16xx.cpp @@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658 C c; } +namespace dr1626 { // dr1626: no open +// FIXME: current consensus for CWG2335 is that the examples are well-formed. +#if __cplusplus >= 201103L +namespace ex1 { +template struct C { + template static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); +}; +template struct C; +} // namespace ex1 + +namespace ex2 { +struct C { + static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); + // expected-error@-1 {{in-class initializer for static data member is not a constant expression}} +}; +C c; +} // namespace ex2 +#endif +} // namespace dr1626 + namespace dr1631 { // dr1631: 3.7 #if __cplusplus >= 201103L // Incorrect overload resolution for single-element initializer-list diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index fbe67bd0c2f6db..0a0213c28595fd 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcx
[Lldb-commits] [libc] [clang-tools-extra] [flang] [libcxx] [lld] [compiler-rt] [libunwind] [llvm] [libclc] [lldb] [clang] [clang] Add tests for DRs about complete-class context (PR #77444)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/77444 >From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 9 Jan 2024 14:17:21 +0300 Subject: [PATCH 1/3] [clang] Add tests for DRs about complete-class context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. [Drafting note: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — end drafting note] ([class.member.lookup]/4) Complete-class context is described in [class.mem.general] [p7](http://eel.is/c++draft/class#mem.general-7) and [p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests only for CWG issues that fall under current definition of complete-class context, because I'm not sure how CWG1255 and CWG287 are going to work. That's why I skip over them, but mark CWG1308 as superseded by CWG1330. --- clang/test/CXX/drs/dr13xx.cpp | 2 ++ clang/test/CXX/drs/dr16xx.cpp | 22 clang/test/CXX/drs/dr18xx.cpp | 38 +++ clang/test/CXX/drs/dr2335.cpp | 48 +++ clang/www/cxx_dr_status.html | 8 +++--- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 clang/test/CXX/drs/dr2335.cpp diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp index 359c04b3e0f3d4..81a8a8a361700a 100644 --- a/clang/test/CXX/drs/dr13xx.cpp +++ b/clang/test/CXX/drs/dr13xx.cpp @@ -40,6 +40,8 @@ void caller() { #endif // __cplusplus >= 201103L } // namespace dr1307 +// dr1308: sup 1330 + namespace dr1310 { // dr1310: 5 struct S {} * sp = new S::S; // expected-error@-1 {{qualified reference to 'S' is a constructor name rather than a type in this context}} diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp index 3f074c4d57354a..342240cdc7a43d 100644 --- a/clang/test/CXX/drs/dr16xx.cpp +++ b/clang/test/CXX/drs/dr16xx.cpp @@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658 C c; } +namespace dr1626 { // dr1626: no open +// FIXME: current consensus for CWG2335 is that the examples are well-formed. +#if __cplusplus >= 201103L +namespace ex1 { +template struct C { + template static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); +}; +template struct C; +} // namespace ex1 + +namespace ex2 { +struct C { + static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); + // expected-error@-1 {{in-class initializer for static data member is not a constant expression}} +}; +C c; +} // namespace ex2 +#endif +} // namespace dr1626 + namespace dr1631 { // dr1631: 3.7 #if __cplusplus >= 201103L // Incorrect overload resolution for single-element initializer-list diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index fbe67bd0c2f6db..0a0213c28595fd 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcx
[Lldb-commits] [libc] [compiler-rt] [libclc] [clang] [llvm] [clang-tools-extra] [lld] [flang] [lldb] [libunwind] [libcxx] [clang] Add tests for DRs about complete-class context (PR #77444)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/77444 >From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 9 Jan 2024 14:17:21 +0300 Subject: [PATCH 1/2] [clang] Add tests for DRs about complete-class context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the unrestricted forward lookup in complete-class contexts (despite current implementation behavior for non-templates). Wording: The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise. [Drafting note: The plan for CWG2335 is to describe forbidden dependency cycles among the complete-class contexts of a class. — end drafting note] ([class.member.lookup]/4) Complete-class context is described in [class.mem.general] [p7](http://eel.is/c++draft/class#mem.general-7) and [p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests only for CWG issues that fall under current definition of complete-class context, because I'm not sure how CWG1255 and CWG287 are going to work. That's why I skip over them, but mark CWG1308 as superseded by CWG1330. --- clang/test/CXX/drs/dr13xx.cpp | 2 ++ clang/test/CXX/drs/dr16xx.cpp | 22 clang/test/CXX/drs/dr18xx.cpp | 38 +++ clang/test/CXX/drs/dr2335.cpp | 48 +++ clang/www/cxx_dr_status.html | 8 +++--- 5 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 clang/test/CXX/drs/dr2335.cpp diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp index 359c04b3e0f3d4..81a8a8a361700a 100644 --- a/clang/test/CXX/drs/dr13xx.cpp +++ b/clang/test/CXX/drs/dr13xx.cpp @@ -40,6 +40,8 @@ void caller() { #endif // __cplusplus >= 201103L } // namespace dr1307 +// dr1308: sup 1330 + namespace dr1310 { // dr1310: 5 struct S {} * sp = new S::S; // expected-error@-1 {{qualified reference to 'S' is a constructor name rather than a type in this context}} diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp index 3f074c4d57354a..342240cdc7a43d 100644 --- a/clang/test/CXX/drs/dr16xx.cpp +++ b/clang/test/CXX/drs/dr16xx.cpp @@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658 C c; } +namespace dr1626 { // dr1626: no open +// FIXME: current consensus for CWG2335 is that the examples are well-formed. +#if __cplusplus >= 201103L +namespace ex1 { +template struct C { + template static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); +}; +template struct C; +} // namespace ex1 + +namespace ex2 { +struct C { + static constexpr bool _S_chk() { return false; } + static const bool __value = _S_chk(); + // expected-error@-1 {{in-class initializer for static data member is not a constant expression}} +}; +C c; +} // namespace ex2 +#endif +} // namespace dr1626 + namespace dr1631 { // dr1631: 3.7 #if __cplusplus >= 201103L // Incorrect overload resolution for single-element initializer-list diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp index fbe67bd0c2f6db..0a0213c28595fd 100644 --- a/clang/test/CXX/drs/dr18xx.cpp +++ b/clang/test/CXX/drs/dr18xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcx
[Lldb-commits] [libc] [libcxx] [llvm] [lld] [lldb] [clang] [flang] [clang][NFC] Refactor expected directives in C++ DRs 100-199 (PR #74061)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/74061 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxx] [lldb] [flang] [lld] [clang] [llvm] [libc] [clang][NFC] Refactor expected directives in C++ DRs 100-199 (PR #74061)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/74061 >From e6b9f54ce066e029b043e72281a7144338a84219 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 1 Dec 2023 13:35:23 +0300 Subject: [PATCH 1/4] [clang][NFC] Fill in historical data on when C++ DRs 100-199 were fixed --- clang/test/CXX/drs/dr1xx.cpp | 20 ++-- clang/www/cxx_dr_status.html | 20 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/clang/test/CXX/drs/dr1xx.cpp b/clang/test/CXX/drs/dr1xx.cpp index 60e80a4c0e1c4f9..50236eb7c9499d4 100644 --- a/clang/test/CXX/drs/dr1xx.cpp +++ b/clang/test/CXX/drs/dr1xx.cpp @@ -72,7 +72,7 @@ namespace dr107 { // dr107: yes extern "C" S operator+(S, S) { return S(); } } -namespace dr108 { // dr108: yes +namespace dr108 { // dr108: 2.9 template struct A { struct B { typedef int X; }; B::X x; @@ -143,7 +143,7 @@ namespace dr114 { // dr114: yes } b; // expected-error {{abstract}} } -namespace dr115 { // dr115: yes +namespace dr115 { // dr115: 3.0 template int f(T); // expected-note +{{}} template int g(T); // expected-note +{{}} template int g(T, int); // expected-note +{{}} @@ -480,7 +480,7 @@ namespace dr140 { // dr140: yes void g(int n) { n = 2; } } -namespace dr141 { // dr141: yes +namespace dr141 { // dr141: 3.1 template void f(); template struct S { int n; }; // expected-note {{'::dr141::S::n' declared here}} struct A : S { @@ -518,7 +518,7 @@ namespace dr141 { // dr141: yes void i() { C().i(); } // ok!! } -namespace dr142 { // dr142: yes +namespace dr142 { // dr142: 2.8 class B { // expected-note +{{here}} public: int mi; // expected-note +{{here}} @@ -602,7 +602,7 @@ namespace dr148 { // dr148: yes // dr149: na -namespace dr151 { // dr151: yes +namespace dr151 { // dr151: 3.1 struct X {}; typedef int X::*p; #if __cplusplus < 201103L @@ -655,7 +655,7 @@ namespace dr159 { // dr159: 3.5 // dr160: na -namespace dr161 { // dr161: yes +namespace dr161 { // dr161: 3.1 class A { protected: struct B { int n; } b; // expected-note 2{{here}} @@ -724,7 +724,7 @@ namespace dr165 { // dr165: no void N::g() {} } -namespace dr166 { // dr166: yes +namespace dr166 { // dr166: 2.9 namespace A { class X; } template int f(T t) { return t.n; } @@ -827,7 +827,7 @@ namespace dr173 { // dr173: yes // dr174: sup 1012 -namespace dr175 { // dr175: yes +namespace dr175 { // dr175: 2.8 struct A {}; // expected-note {{here}} struct B : private A {}; // expected-note {{constrained by private inheritance}} struct C : B { @@ -836,7 +836,7 @@ namespace dr175 { // dr175: yes }; } -namespace dr176 { // dr176: yes +namespace dr176 { // dr176: 3.1 template class Y; template<> class Y { void f() { @@ -904,7 +904,7 @@ namespace dr179 { // dr179: yes int n = &f - &f; // expected-error {{arithmetic on pointers to the function type 'void ()'}} } -namespace dr180 { // dr180: yes +namespace dr180 { // dr180: 2.8 template struct X : T, T::some_base { X() : T::some_type_that_might_be_T(), T::some_base() {} friend class T::some_class; diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 7cf657a47d64093..141b2aa515ad9ad 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -685,7 +685,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/108.html";>108 TC1 Are classes nested in templates dependent? -Yes +Clang 2.9 https://cplusplus.github.io/CWG/issues/109.html";>109 @@ -727,7 +727,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/115.html";>115 CD1 Address of template-id -Yes +Clang 3.0 https://cplusplus.github.io/CWG/issues/116.html";>116 @@ -883,13 +883,13 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/141.html";>141 CD1 Non-member function templates in member access expressions -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/142.html";>142 TC1 Injection-related errors in access example -Yes +Clang 2.8 https://cplusplus.github.io/CWG/issues/143.html";>143 @@ -943,7 +943,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/151.html";>151 TC1 Terminology of zero-initialization -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/152.html";>152 @@ -1003,7 +1003,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/161.html";>161 TC1 Access to protected nested type -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/162.html";>162 @@ -1033,7 +1033,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/166.html";>166 TC1 Friend dec
[Lldb-commits] [lld] [libc] [flang] [lldb] [libcxx] [clang] [llvm] [clang][NFC] Refactor expected directives in C++ DRs 100-199 (PR #74061)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/74061 >From e6b9f54ce066e029b043e72281a7144338a84219 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 1 Dec 2023 13:35:23 +0300 Subject: [PATCH 1/3] [clang][NFC] Fill in historical data on when C++ DRs 100-199 were fixed --- clang/test/CXX/drs/dr1xx.cpp | 20 ++-- clang/www/cxx_dr_status.html | 20 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/clang/test/CXX/drs/dr1xx.cpp b/clang/test/CXX/drs/dr1xx.cpp index 60e80a4c0e1c4f9..50236eb7c9499d4 100644 --- a/clang/test/CXX/drs/dr1xx.cpp +++ b/clang/test/CXX/drs/dr1xx.cpp @@ -72,7 +72,7 @@ namespace dr107 { // dr107: yes extern "C" S operator+(S, S) { return S(); } } -namespace dr108 { // dr108: yes +namespace dr108 { // dr108: 2.9 template struct A { struct B { typedef int X; }; B::X x; @@ -143,7 +143,7 @@ namespace dr114 { // dr114: yes } b; // expected-error {{abstract}} } -namespace dr115 { // dr115: yes +namespace dr115 { // dr115: 3.0 template int f(T); // expected-note +{{}} template int g(T); // expected-note +{{}} template int g(T, int); // expected-note +{{}} @@ -480,7 +480,7 @@ namespace dr140 { // dr140: yes void g(int n) { n = 2; } } -namespace dr141 { // dr141: yes +namespace dr141 { // dr141: 3.1 template void f(); template struct S { int n; }; // expected-note {{'::dr141::S::n' declared here}} struct A : S { @@ -518,7 +518,7 @@ namespace dr141 { // dr141: yes void i() { C().i(); } // ok!! } -namespace dr142 { // dr142: yes +namespace dr142 { // dr142: 2.8 class B { // expected-note +{{here}} public: int mi; // expected-note +{{here}} @@ -602,7 +602,7 @@ namespace dr148 { // dr148: yes // dr149: na -namespace dr151 { // dr151: yes +namespace dr151 { // dr151: 3.1 struct X {}; typedef int X::*p; #if __cplusplus < 201103L @@ -655,7 +655,7 @@ namespace dr159 { // dr159: 3.5 // dr160: na -namespace dr161 { // dr161: yes +namespace dr161 { // dr161: 3.1 class A { protected: struct B { int n; } b; // expected-note 2{{here}} @@ -724,7 +724,7 @@ namespace dr165 { // dr165: no void N::g() {} } -namespace dr166 { // dr166: yes +namespace dr166 { // dr166: 2.9 namespace A { class X; } template int f(T t) { return t.n; } @@ -827,7 +827,7 @@ namespace dr173 { // dr173: yes // dr174: sup 1012 -namespace dr175 { // dr175: yes +namespace dr175 { // dr175: 2.8 struct A {}; // expected-note {{here}} struct B : private A {}; // expected-note {{constrained by private inheritance}} struct C : B { @@ -836,7 +836,7 @@ namespace dr175 { // dr175: yes }; } -namespace dr176 { // dr176: yes +namespace dr176 { // dr176: 3.1 template class Y; template<> class Y { void f() { @@ -904,7 +904,7 @@ namespace dr179 { // dr179: yes int n = &f - &f; // expected-error {{arithmetic on pointers to the function type 'void ()'}} } -namespace dr180 { // dr180: yes +namespace dr180 { // dr180: 2.8 template struct X : T, T::some_base { X() : T::some_type_that_might_be_T(), T::some_base() {} friend class T::some_class; diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 7cf657a47d64093..141b2aa515ad9ad 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -685,7 +685,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/108.html";>108 TC1 Are classes nested in templates dependent? -Yes +Clang 2.9 https://cplusplus.github.io/CWG/issues/109.html";>109 @@ -727,7 +727,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/115.html";>115 CD1 Address of template-id -Yes +Clang 3.0 https://cplusplus.github.io/CWG/issues/116.html";>116 @@ -883,13 +883,13 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/141.html";>141 CD1 Non-member function templates in member access expressions -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/142.html";>142 TC1 Injection-related errors in access example -Yes +Clang 2.8 https://cplusplus.github.io/CWG/issues/143.html";>143 @@ -943,7 +943,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/151.html";>151 TC1 Terminology of zero-initialization -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/152.html";>152 @@ -1003,7 +1003,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/161.html";>161 TC1 Access to protected nested type -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/162.html";>162 @@ -1033,7 +1033,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/166.html";>166 TC1 Friend dec
[Lldb-commits] [flang] [libcxx] [lld] [libc] [clang] [lldb] [llvm] [clang][NFC] Refactor expected directives in C++ DRs 100-199 (PR #74061)
Endilll wrote: This PR is created to run the patch through CI, so no review requested. https://github.com/llvm/llvm-project/pull/74061 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [libcxx] [lld] [libc] [clang] [lldb] [llvm] [clang][NFC] Refactor expected directives in C++ DRs 100-199 (PR #74061)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/74061 This patch continues the work started with ea5b1ef016d020c37f903d6c7d4f623be975dab8. See that commit and its corresponding PR for details. >From e6b9f54ce066e029b043e72281a7144338a84219 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Fri, 1 Dec 2023 13:35:23 +0300 Subject: [PATCH 1/2] [clang][NFC] Fill in historical data on when C++ DRs 100-199 were fixed --- clang/test/CXX/drs/dr1xx.cpp | 20 ++-- clang/www/cxx_dr_status.html | 20 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/clang/test/CXX/drs/dr1xx.cpp b/clang/test/CXX/drs/dr1xx.cpp index 60e80a4c0e1c4f9..50236eb7c9499d4 100644 --- a/clang/test/CXX/drs/dr1xx.cpp +++ b/clang/test/CXX/drs/dr1xx.cpp @@ -72,7 +72,7 @@ namespace dr107 { // dr107: yes extern "C" S operator+(S, S) { return S(); } } -namespace dr108 { // dr108: yes +namespace dr108 { // dr108: 2.9 template struct A { struct B { typedef int X; }; B::X x; @@ -143,7 +143,7 @@ namespace dr114 { // dr114: yes } b; // expected-error {{abstract}} } -namespace dr115 { // dr115: yes +namespace dr115 { // dr115: 3.0 template int f(T); // expected-note +{{}} template int g(T); // expected-note +{{}} template int g(T, int); // expected-note +{{}} @@ -480,7 +480,7 @@ namespace dr140 { // dr140: yes void g(int n) { n = 2; } } -namespace dr141 { // dr141: yes +namespace dr141 { // dr141: 3.1 template void f(); template struct S { int n; }; // expected-note {{'::dr141::S::n' declared here}} struct A : S { @@ -518,7 +518,7 @@ namespace dr141 { // dr141: yes void i() { C().i(); } // ok!! } -namespace dr142 { // dr142: yes +namespace dr142 { // dr142: 2.8 class B { // expected-note +{{here}} public: int mi; // expected-note +{{here}} @@ -602,7 +602,7 @@ namespace dr148 { // dr148: yes // dr149: na -namespace dr151 { // dr151: yes +namespace dr151 { // dr151: 3.1 struct X {}; typedef int X::*p; #if __cplusplus < 201103L @@ -655,7 +655,7 @@ namespace dr159 { // dr159: 3.5 // dr160: na -namespace dr161 { // dr161: yes +namespace dr161 { // dr161: 3.1 class A { protected: struct B { int n; } b; // expected-note 2{{here}} @@ -724,7 +724,7 @@ namespace dr165 { // dr165: no void N::g() {} } -namespace dr166 { // dr166: yes +namespace dr166 { // dr166: 2.9 namespace A { class X; } template int f(T t) { return t.n; } @@ -827,7 +827,7 @@ namespace dr173 { // dr173: yes // dr174: sup 1012 -namespace dr175 { // dr175: yes +namespace dr175 { // dr175: 2.8 struct A {}; // expected-note {{here}} struct B : private A {}; // expected-note {{constrained by private inheritance}} struct C : B { @@ -836,7 +836,7 @@ namespace dr175 { // dr175: yes }; } -namespace dr176 { // dr176: yes +namespace dr176 { // dr176: 3.1 template class Y; template<> class Y { void f() { @@ -904,7 +904,7 @@ namespace dr179 { // dr179: yes int n = &f - &f; // expected-error {{arithmetic on pointers to the function type 'void ()'}} } -namespace dr180 { // dr180: yes +namespace dr180 { // dr180: 2.8 template struct X : T, T::some_base { X() : T::some_type_that_might_be_T(), T::some_base() {} friend class T::some_class; diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 7cf657a47d64093..141b2aa515ad9ad 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -685,7 +685,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/108.html";>108 TC1 Are classes nested in templates dependent? -Yes +Clang 2.9 https://cplusplus.github.io/CWG/issues/109.html";>109 @@ -727,7 +727,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/115.html";>115 CD1 Address of template-id -Yes +Clang 3.0 https://cplusplus.github.io/CWG/issues/116.html";>116 @@ -883,13 +883,13 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/141.html";>141 CD1 Non-member function templates in member access expressions -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/142.html";>142 TC1 Injection-related errors in access example -Yes +Clang 2.8 https://cplusplus.github.io/CWG/issues/143.html";>143 @@ -943,7 +943,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/151.html";>151 TC1 Terminology of zero-initialization -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/152.html";>152 @@ -1003,7 +1003,7 @@ C++ defect report implementation status https://cplusplus.github.io/CWG/issues/161.html";>161 TC1 Access to protected nested type -Yes +Clang 3.1 https://cplusplus.github.io/CWG/issues/162.html";>162 @@ -
[Lldb-commits] [flang] [libcxx] [lldb] [libc] [llvm] [libunwind] [clang] [lld] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/73879 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [libcxx] [compiler-rt] [clang] [llvm] [lldb] [clang-tools-extra] [libc] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: > The human-readability of a big list of integers is not better than embedded > base64 -- and actually, seems more of a pain to decode. I agree that the entirety of the data is not too comprehensible, but I can imagine users being interested in the first and last N bytes when they tweak offset and length of the embed. In this case list of integers is a clear winner. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [compiler-rt] [lldb] [llvm] [flang] [libcxx] [clang] [clang-tools-extra] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: Your reasoning works until we have a crash that relies on `#embed` and/or its contents. >From what I saw triaging old crashes, crash submitters are conscious if they >work with proprietary code they can't share even a fragment of, and not so >rarely reduce crash by themselves. I'm not fond of the idea on giving up on >every embed-related crash, because there is a risk (which I'm not estimating >high), that submitter forgot to check their otherwise open code for sensitive >information. This doesn't help us ironing out bugs in `#embed` implementation >in the long run. One might say that additional back-and-forth with crash submitter is not too big of a deal, and it would be, if we haven't had ever-growing backlog of issues, some dating back more than a decade. Our existing workflow that allows people to drop attachments on us and forget about it has proven itself useful in the very long run. So I'd like us to keep this. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang-tools-extra] [libc] [libcxx] [compiler-rt] [flang] [llvm] [clang] [lldb] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: I'd also like to highlight the use case of diagnostic for compiler crashes. IIRC preprocessed source to attach to an issue is produced with `-frewrite-includes`, so we might want to change its behavior for `#embed`. This might be a good use case for `#embed_base64`. https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [compiler-rt] [llvm] [lldb] [libcxx] [flang] [libc] [clang-tools-extra] [clang] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: @AaronBallman Can you describe your current plan how driver options are going to behave in the light of `#embed`? https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [clang] [clang-tools-extra] [libc] [flang] [libcxx] [compiler-rt] ✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (PR #68620)
Endilll wrote: There has been multiple discussion in different places about behavior of `-E`, `-M`, and friends (the most notable starts [here](https://discord.com/channels/636084430946959380/636732781086638081/1175241241710055424)), so I thought it would be a good idea to raise awareness among commonly used tools. `ccache`, `sccache`, and `distcc` are the ones I know that might be directly impacted by this. https://github.com/ccache/ccache/discussions/1366 https://github.com/mozilla/sccache/discussions/1990 https://github.com/distcc/distcc/issues/494 https://github.com/llvm/llvm-project/pull/68620 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
Endilll wrote: @DavidSpickett There is `SBValue:SetFormat()`, which takes `lldb::Format`. We can invent a new format, e.g. `eFormatEnumWithValue`. Not every enum flows through my formatter, as I'm actively improving emitted debug info so that LLDB does the right thing by default (`[[clang::preferred_type]]` is one example), reducing formatter boilerplate. So I'd prefer something global and possibly under user control, rather than doing it from formatter side. How does this sound to you? https://github.com/llvm/llvm-project/pull/69815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
Endilll wrote: > For this use case I'm setting options in lldb_private::DumpValueObjectOptions > down in C++ but I'm not sure if those directly map to what a formatter would > have access to. @DavidSpickett What exactly do you set or unset there to get the output you're showing? This approach seems novel to me, so I'd like to investigate it. https://github.com/llvm/llvm-project/pull/69815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [flang] [compiler-rt] [openmp] [clang] [mlir] [libcxx] [lldb] [clang-tools-extra] [clang][NFC] Refactor `TagTypeKind` (PR #71160)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/71160 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [flang] [compiler-rt] [libc] [llvm] [lldb] [lld] [libcxx] [clang-tools-extra] [clang] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/70349 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [llvm] [compiler-rt] [libcxx] [libc] [flang] [clang] [lldb] [clang-tools-extra] [lld] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/70349 >From 7329f68092d5f8f5a5978e5a6cbad6ada87d4fe8 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Thu, 26 Oct 2023 16:09:25 +0300 Subject: [PATCH 1/7] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` --- clang/include/clang/AST/DeclBase.h| 2 +- clang/include/clang/AST/DependenceFlags.h | 2 +- clang/include/clang/AST/Type.h| 46 ++- clang/include/clang/Basic/Linkage.h | 2 +- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 978e4255e877ec2..0307691fdd480bf 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -49,7 +49,7 @@ class ExternalSourceSymbolAttr; class FunctionDecl; class FunctionType; class IdentifierInfo; -enum Linkage : unsigned char; +enum Linkage : unsigned; class LinkageSpecDecl; class Module; class NamedDecl; diff --git a/clang/include/clang/AST/DependenceFlags.h b/clang/include/clang/AST/DependenceFlags.h index 3b3c1afb096addd..e91b6ff35b34966 100644 --- a/clang/include/clang/AST/DependenceFlags.h +++ b/clang/include/clang/AST/DependenceFlags.h @@ -49,7 +49,7 @@ struct ExprDependenceScope { using ExprDependence = ExprDependenceScope::ExprDependence; struct TypeDependenceScope { - enum TypeDependence : uint8_t { + enum TypeDependence : unsigned { /// Whether this type contains an unexpanded parameter pack /// (for C++11 variadic templates) UnexpandedPack = 1, diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 1e8e1303e65f6ba..f24b1dccc240785 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -1611,22 +1611,28 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { template friend class TypePropertyCache; /// TypeClass bitfield - Enum that specifies what subclass this belongs to. +[[clang::preferred_type(TypeClass)]] unsigned TC : 8; /// Store information on the type dependency. +[[clang::preferred_type(TypeDependence)]] unsigned Dependence : llvm::BitWidth; /// True if the cache (i.e. the bitfields here starting with /// 'Cache') is valid. +[[clang::preferred_type(bool)]] mutable unsigned CacheValid : 1; /// Linkage of this type. +[[clang::preferred_type(Linkage)]] mutable unsigned CachedLinkage : 3; /// Whether this type involves and local or unnamed types. +[[clang::preferred_type(bool)]] mutable unsigned CachedLocalOrUnnamed : 1; /// Whether this type comes from an AST file. +[[clang::preferred_type(bool)]] mutable unsigned FromAST : 1; bool isCacheValid() const { @@ -1652,10 +1658,12 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { class ArrayTypeBitfields { friend class ArrayType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// CVR qualifiers from declarations like /// 'int X[static restrict 4]'. For function parameters only. +[[clang::preferred_type(Qualifiers)]] unsigned IndexTypeQuals : 3; /// Storage class qualifiers from declarations like @@ -1671,12 +1679,14 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned : NumArrayTypeBits; /// Whether we have a stored size expression. +[[clang::preferred_type(bool)]] unsigned HasStoredSizeExpr : 1; }; class BuiltinTypeBitfields { friend class BuiltinType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// The kind (BuiltinType::Kind) of builtin type this is. @@ -1691,15 +1701,18 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { friend class FunctionProtoType; friend class FunctionType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// Extra information which affects how the function is called, like /// regparm and the calling convention. +[[clang::preferred_type(CallingConv)]] unsigned ExtInfo : 13; /// The ref-qualifier associated with a \c FunctionProtoType. /// /// This is a value of type \c RefQualifierKind. +[[clang::preferred_type(RefQualifierKind)]] unsigned RefQualifier : 2; /// Used only by FunctionProtoType, put here to pack with the @@ -1708,8 +1721,10 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { /// /// C++ 8.3.5p4: The return type, the parameter type list and the /// cv-qualifier-seq, [...], are part of the function type. +[[clang::preferred_type(Qualifiers)]] unsigned FastTypeQuals : Qualifiers::FastWidth; /// Whether this function has extended Qualifiers. +[[clang::preferred_type(bool)]] unsigned HasExtQuals : 1; /// The number of parameters
[Lldb-commits] [libc] [clang] [lld] [clang-tools-extra] [flang] [libcxx] [llvm] [lldb] [compiler-rt] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)
@@ -49,7 +49,7 @@ struct ExprDependenceScope { using ExprDependence = ExprDependenceScope::ExprDependence; struct TypeDependenceScope { - enum TypeDependence : uint8_t { + enum TypeDependence : unsigned { Endilll wrote: I reverted changes to underlying types. This should be good to go now. https://github.com/llvm/llvm-project/pull/70349 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [clang] [lld] [clang-tools-extra] [flang] [libcxx] [llvm] [lldb] [compiler-rt] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` (PR #70349)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/70349 >From 7329f68092d5f8f5a5978e5a6cbad6ada87d4fe8 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Thu, 26 Oct 2023 16:09:25 +0300 Subject: [PATCH 1/6] [clang][NFC] Annotate `Type` bit-fields with `clang::preferred_type` --- clang/include/clang/AST/DeclBase.h| 2 +- clang/include/clang/AST/DependenceFlags.h | 2 +- clang/include/clang/AST/Type.h| 46 ++- clang/include/clang/Basic/Linkage.h | 2 +- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 978e4255e877ec2..0307691fdd480bf 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -49,7 +49,7 @@ class ExternalSourceSymbolAttr; class FunctionDecl; class FunctionType; class IdentifierInfo; -enum Linkage : unsigned char; +enum Linkage : unsigned; class LinkageSpecDecl; class Module; class NamedDecl; diff --git a/clang/include/clang/AST/DependenceFlags.h b/clang/include/clang/AST/DependenceFlags.h index 3b3c1afb096addd..e91b6ff35b34966 100644 --- a/clang/include/clang/AST/DependenceFlags.h +++ b/clang/include/clang/AST/DependenceFlags.h @@ -49,7 +49,7 @@ struct ExprDependenceScope { using ExprDependence = ExprDependenceScope::ExprDependence; struct TypeDependenceScope { - enum TypeDependence : uint8_t { + enum TypeDependence : unsigned { /// Whether this type contains an unexpanded parameter pack /// (for C++11 variadic templates) UnexpandedPack = 1, diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 1e8e1303e65f6ba..f24b1dccc240785 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -1611,22 +1611,28 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { template friend class TypePropertyCache; /// TypeClass bitfield - Enum that specifies what subclass this belongs to. +[[clang::preferred_type(TypeClass)]] unsigned TC : 8; /// Store information on the type dependency. +[[clang::preferred_type(TypeDependence)]] unsigned Dependence : llvm::BitWidth; /// True if the cache (i.e. the bitfields here starting with /// 'Cache') is valid. +[[clang::preferred_type(bool)]] mutable unsigned CacheValid : 1; /// Linkage of this type. +[[clang::preferred_type(Linkage)]] mutable unsigned CachedLinkage : 3; /// Whether this type involves and local or unnamed types. +[[clang::preferred_type(bool)]] mutable unsigned CachedLocalOrUnnamed : 1; /// Whether this type comes from an AST file. +[[clang::preferred_type(bool)]] mutable unsigned FromAST : 1; bool isCacheValid() const { @@ -1652,10 +1658,12 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { class ArrayTypeBitfields { friend class ArrayType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// CVR qualifiers from declarations like /// 'int X[static restrict 4]'. For function parameters only. +[[clang::preferred_type(Qualifiers)]] unsigned IndexTypeQuals : 3; /// Storage class qualifiers from declarations like @@ -1671,12 +1679,14 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned : NumArrayTypeBits; /// Whether we have a stored size expression. +[[clang::preferred_type(bool)]] unsigned HasStoredSizeExpr : 1; }; class BuiltinTypeBitfields { friend class BuiltinType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// The kind (BuiltinType::Kind) of builtin type this is. @@ -1691,15 +1701,18 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { friend class FunctionProtoType; friend class FunctionType; +[[clang::preferred_type(TypeBitfields)]] unsigned : NumTypeBits; /// Extra information which affects how the function is called, like /// regparm and the calling convention. +[[clang::preferred_type(CallingConv)]] unsigned ExtInfo : 13; /// The ref-qualifier associated with a \c FunctionProtoType. /// /// This is a value of type \c RefQualifierKind. +[[clang::preferred_type(RefQualifierKind)]] unsigned RefQualifier : 2; /// Used only by FunctionProtoType, put here to pack with the @@ -1708,8 +1721,10 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { /// /// C++ 8.3.5p4: The return type, the parameter type list and the /// cv-qualifier-seq, [...], are part of the function type. +[[clang::preferred_type(Qualifiers)]] unsigned FastTypeQuals : Qualifiers::FastWidth; /// Whether this function has extended Qualifiers. +[[clang::preferred_type(bool)]] unsigned HasExtQuals : 1; /// The number of parameters
[Lldb-commits] [lldb] [clang] [clang][NFC] Rename ArgPassingKind to RecordArgPassingKind (PR #70955)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/70955 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang][NFC] Rename ArgPassingKind to RecordArgPassingKind (PR #70955)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/70955 During the recent refactoring (b120fe8d3288c4dca1b5427ca34839ce8833f71c) this enum was moved out of `RecordDecl`. During post-commit review it was found out that its association with `RecordDecl` should be expressed in the name. I'm planning to land this as soon as CI passes, probably without waiting for Windows bot. >From 99013f89d8a5d62828e351e49a11d04fe13645ae Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 1 Nov 2023 19:24:22 +0300 Subject: [PATCH] [clang][NFC] Rename ArgPassingKind to RecordArgPassingKind During the recent refactoring (b120fe8d3288c4dca1b5427ca34839ce8833f71c) this enum was moved out of `RecordDecl`. During post-commit review it was found out that its association with `RecordDecl` should be expresses in the name. --- clang/include/clang/AST/Decl.h| 11 ++- clang/include/clang/AST/DeclBase.h| 2 +- clang/lib/AST/Decl.cpp| 2 +- clang/lib/AST/DeclCXX.cpp | 10 +- clang/lib/CodeGen/CGCall.cpp | 3 ++- clang/lib/Sema/SemaDecl.cpp | 8 +--- clang/lib/Sema/SemaDeclCXX.cpp| 9 + clang/lib/Serialization/ASTReaderDecl.cpp | 4 ++-- .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 2 +- 9 files changed, 28 insertions(+), 23 deletions(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index d9b00b1628ab25c..d8ea8c1dfb4f292 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -4063,7 +4063,7 @@ class EnumDecl : public TagDecl { /// returned from function calls. This takes into account the target-specific /// and version-specific rules along with the rules determined by the /// language. -enum class ArgPassingKind { +enum class RecordArgPassingKind { /// The argument of this type can be passed directly in registers. CanPassInRegs, @@ -4216,14 +4216,15 @@ class RecordDecl : public TagDecl { /// it must have at least one trivial, non-deleted copy or move constructor. /// FIXME: This should be set as part of completeDefinition. bool canPassInRegisters() const { -return getArgPassingRestrictions() == ArgPassingKind::CanPassInRegs; +return getArgPassingRestrictions() == RecordArgPassingKind::CanPassInRegs; } - ArgPassingKind getArgPassingRestrictions() const { -return static_cast(RecordDeclBits.ArgPassingRestrictions); + RecordArgPassingKind getArgPassingRestrictions() const { +return static_cast( +RecordDeclBits.ArgPassingRestrictions); } - void setArgPassingRestrictions(ArgPassingKind Kind) { + void setArgPassingRestrictions(RecordArgPassingKind Kind) { RecordDeclBits.ArgPassingRestrictions = llvm::to_underlying(Kind); } diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 6704c0cd41ecd3d..df1d6e8a3b5af72 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1399,7 +1399,7 @@ enum class DeductionCandidate : unsigned char { Aggregate, }; -enum class ArgPassingKind; +enum class RecordArgPassingKind; enum class OMPDeclareReductionInitKind; enum class ObjCImplementationControl; enum class LinkageSpecLanguageIDs; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 28243a76712d63e..6efc177d61c03ba 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -4932,7 +4932,7 @@ RecordDecl::RecordDecl(Kind DK, TagKind TK, const ASTContext &C, setHasNonTrivialToPrimitiveDestructCUnion(false); setHasNonTrivialToPrimitiveCopyCUnion(false); setParamDestroyedInCallee(false); - setArgPassingRestrictions(ArgPassingKind::CanPassInRegs); + setArgPassingRestrictions(RecordArgPassingKind::CanPassInRegs); setIsRandomized(false); setODRHash(0); } diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 066b62b7c24110d..4002c63e9f94c12 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -446,8 +446,8 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, setHasVolatileMember(true); if (BaseClassDecl->getArgPassingRestrictions() == -ArgPassingKind::CanNeverPassInRegs) - setArgPassingRestrictions(ArgPassingKind::CanNeverPassInRegs); +RecordArgPassingKind::CanNeverPassInRegs) + setArgPassingRestrictions(RecordArgPassingKind::CanNeverPassInRegs); // Keep track of the presence of mutable fields. if (BaseClassDecl->hasMutableFields()) @@ -1032,7 +1032,7 @@ void CXXRecordDecl::addedMember(Decl *D) { // Structs with __weak fields should never be passed directly. if (LT == Qualifiers::OCL_Weak) - setArgPassingRestrictions(ArgPassingKind::CanNeverPassInRegs); + setArgPassingRestrictions(RecordArgPassingKind:
[Lldb-commits] [lldb] 6576120 - [clang][NFC] Refactor `LinkageSpecDecl::LanguageIDs`
Author: Vlad Serebrennikov Date: 2023-11-01T16:44:34+03:00 New Revision: 65761200ce4e1f366e8418652efdafd2f744291b URL: https://github.com/llvm/llvm-project/commit/65761200ce4e1f366e8418652efdafd2f744291b DIFF: https://github.com/llvm/llvm-project/commit/65761200ce4e1f366e8418652efdafd2f744291b.diff LOG: [clang][NFC] Refactor `LinkageSpecDecl::LanguageIDs` This patch converts `LinkageSpecDecl::LanguageIDs` into scoped enum, and moves it to namespace scope, so that it can be forward-declared where required. Added: Modified: clang/include/clang/AST/DeclBase.h clang/include/clang/AST/DeclCXX.h clang/lib/AST/DeclBase.cpp clang/lib/AST/DeclCXX.cpp clang/lib/AST/DeclPrinter.cpp clang/lib/AST/JSONNodeDumper.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaModule.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriterDecl.cpp lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp Removed: diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 6f2c5b96554a9d1..32b6aed6397668c 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1430,6 +1430,8 @@ enum class OMPDeclareReductionInitKind { enum class ObjCImplementationControl { None, Required, Optional }; +enum class LinkageSpecLanguageIDs; + /// DeclContext - This is used only as base class of specific decl types that /// can act as declaration contexts. These decls are (only the top classes /// that directly derive from DeclContext are mentioned, not their subclasses): diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 5eaae6bdd2bc63e..df1dc5a401f39a5 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -2897,6 +2897,12 @@ class CXXConversionDecl : public CXXMethodDecl { static bool classofKind(Kind K) { return K == CXXConversion; } }; +/// Represents the language in a linkage specification. +/// +/// The values are part of the serialization ABI for +/// ASTs and cannot be changed without altering that ABI. +enum class LinkageSpecLanguageIDs { C = 1, CXX = 2 }; + /// Represents a linkage specification. /// /// For example: @@ -2907,14 +2913,7 @@ class LinkageSpecDecl : public Decl, public DeclContext { virtual void anchor(); // This class stores some data in DeclContext::LinkageSpecDeclBits to save // some space. Use the provided accessors to access it. -public: - /// Represents the language in a linkage specification. - /// - /// The values are part of the serialization ABI for - /// ASTs and cannot be changed without altering that ABI. - enum LanguageIDs { lang_c = 1, lang_cxx = 2 }; -private: /// The source location for the extern keyword. SourceLocation ExternLoc; @@ -2922,22 +2921,25 @@ class LinkageSpecDecl : public Decl, public DeclContext { SourceLocation RBraceLoc; LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc, - SourceLocation LangLoc, LanguageIDs lang, bool HasBraces); + SourceLocation LangLoc, LinkageSpecLanguageIDs lang, + bool HasBraces); public: static LinkageSpecDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, - SourceLocation LangLoc, LanguageIDs Lang, - bool HasBraces); + SourceLocation LangLoc, + LinkageSpecLanguageIDs Lang, bool HasBraces); static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID); /// Return the language specified by this linkage specification. - LanguageIDs getLanguage() const { -return static_cast(LinkageSpecDeclBits.Language); + LinkageSpecLanguageIDs getLanguage() const { +return static_cast(LinkageSpecDeclBits.Language); } /// Set the language specified by this linkage specification. - void setLanguage(LanguageIDs L) { LinkageSpecDeclBits.Language = L; } + void setLanguage(LinkageSpecLanguageIDs L) { +LinkageSpecDeclBits.Language = llvm::to_underlying(L); + } /// Determines whether this linkage specification had braces in /// its syntactic form. diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index a3847a73faf8183..3fd4751d6d1f31d 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -1320,7 +1320,7 @@ bool DeclContext::isTransparentContext() const { } static bool isLinkageSpecContext(const DeclContext *DC, - LinkageSpecDecl::LanguageIDs ID) { + LinkageSpecLanguageIDs ID) { while (DC->getDeclKind() != Decl::Translati
[Lldb-commits] [lldb] aaba376 - [clang][NFC] Refactor `ObjCMethodDecl::ImplementationControl`
Author: Vlad Serebrennikov Date: 2023-11-01T13:40:11+03:00 New Revision: aaba3761db84032541712899964714f3184e8b3d URL: https://github.com/llvm/llvm-project/commit/aaba3761db84032541712899964714f3184e8b3d DIFF: https://github.com/llvm/llvm-project/commit/aaba3761db84032541712899964714f3184e8b3d.diff LOG: [clang][NFC] Refactor `ObjCMethodDecl::ImplementationControl` This patch moves `ObjCMethodDecl::ImplementationControl` to a DeclBase.h so that it's complete at the point where corresponsing bit-field is declared. This patch also converts it to a scoped enum `clang::ObjCImplementationControl`. Added: Modified: clang/include/clang/AST/DeclBase.h clang/include/clang/AST/DeclObjC.h clang/lib/ARCMigrate/ObjCMT.cpp clang/lib/AST/DeclObjC.cpp clang/lib/AST/ODRDiagsEmitter.cpp clang/lib/AST/ODRHash.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp clang/lib/Sema/SemaDeclObjC.cpp clang/lib/Sema/SemaExprObjC.cpp clang/lib/Sema/SemaObjCProperty.cpp clang/lib/Sema/SemaPseudoObject.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/tools/libclang/CIndex.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp Removed: diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 7b743edf9452526..6f2c5b96554a9d1 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1428,6 +1428,8 @@ enum class OMPDeclareReductionInitKind { Copy// omp_priv = }; +enum class ObjCImplementationControl { None, Required, Optional }; + /// DeclContext - This is used only as base class of specific decl types that /// can act as declaration contexts. These decls are (only the top classes /// that directly derive from DeclContext are mentioned, not their subclasses): diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index ee8ec7a6a016ba3..2b205bee51de18e 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -139,10 +139,6 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { // This class stores some data in DeclContext::ObjCMethodDeclBits // to save some space. Use the provided accessors to access it. -public: - enum ImplementationControl { None, Required, Optional }; - -private: /// Return type of this method. QualType MethodDeclType; @@ -168,14 +164,14 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { /// constructed by createImplicitParams. ImplicitParamDecl *CmdDecl = nullptr; - ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc, - Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, - DeclContext *contextDecl, bool isInstance = true, - bool isVariadic = false, bool isPropertyAccessor = false, - bool isSynthesizedAccessorStub = false, - bool isImplicitlyDeclared = false, bool isDefined = false, - ImplementationControl impControl = None, - bool HasRelatedResultType = false); + ObjCMethodDecl( + SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, + QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, + bool isInstance = true, bool isVariadic = false, + bool isPropertyAccessor = false, bool isSynthesizedAccessorStub = false, + bool isImplicitlyDeclared = false, bool isDefined = false, + ObjCImplementationControl impControl = ObjCImplementationControl::None, + bool HasRelatedResultType = false); SelectorLocationsKind getSelLocsKind() const { return static_cast(ObjCMethodDeclBits.SelLocsKind); @@ -235,7 +231,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { bool isVariadic = false, bool isPropertyAccessor = false, bool isSynthesizedAccessorStub = false, bool isImplicitlyDeclared = false, bool isDefined = false, - ImplementationControl impControl = None, + ObjCImplementationControl impControl = ObjCImplementationControl::None, bool HasRelatedResultType = false); static ObjCMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID); @@ -495,16 +491,17 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { const ObjCPropertyDecl *findPropertyDecl(bool CheckOverrides = true) const; // Related to protocols declared in \@protocol - void setDeclImplementation(ImplementationControl ic) { -ObjCMethodDeclBits.DeclImplementation = ic; + void setDeclImplementation(ObjCImplementationControl ic) { +ObjCMethodDeclBits.DeclImplementation = llvm::to_underlying(ic); } - ImplementationControl getImplementa
[Lldb-commits] [lldb] b120fe8 - [clang][NFC] Refactor `ArgPassingKind`
Author: Vlad Serebrennikov Date: 2023-11-01T11:49:59+03:00 New Revision: b120fe8d3288c4dca1b5427ca34839ce8833f71c URL: https://github.com/llvm/llvm-project/commit/b120fe8d3288c4dca1b5427ca34839ce8833f71c DIFF: https://github.com/llvm/llvm-project/commit/b120fe8d3288c4dca1b5427ca34839ce8833f71c.diff LOG: [clang][NFC] Refactor `ArgPassingKind` This patch moves `RecordDecl::ArgPassingKind` to DeclBase.h to namespace scope, so that it's complete at the time bit-field is declared. Added: Modified: clang/include/clang/AST/Decl.h clang/include/clang/AST/DeclBase.h clang/lib/AST/Decl.cpp clang/lib/AST/DeclCXX.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Removed: diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 7f076cc77ea82cb..1c2158f51aa184d 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -4069,28 +4069,6 @@ class RecordDecl : public TagDecl { public: friend class DeclContext; friend class ASTDeclReader; - /// Enum that represents the diff erent ways arguments are passed to and - /// returned from function calls. This takes into account the target-specific - /// and version-specific rules along with the rules determined by the - /// language. - enum ArgPassingKind : unsigned { -/// The argument of this type can be passed directly in registers. -APK_CanPassInRegs, - -/// The argument of this type cannot be passed directly in registers. -/// Records containing this type as a subobject are not forced to be passed -/// indirectly. This value is used only in C++. This value is required by -/// C++ because, in uncommon situations, it is possible for a class to have -/// only trivial copy/move constructors even when one of its subobjects has -/// a non-trivial copy/move constructor (if e.g. the corresponding copy/move -/// constructor in the derived class is deleted). -APK_CannotPassInRegs, - -/// The argument of this type cannot be passed directly in registers. -/// Records containing this type as a subobject are forced to be passed -/// indirectly. -APK_CanNeverPassInRegs - }; protected: RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, @@ -4215,7 +4193,7 @@ class RecordDecl : public TagDecl { /// it must have at least one trivial, non-deleted copy or move constructor. /// FIXME: This should be set as part of completeDefinition. bool canPassInRegisters() const { -return getArgPassingRestrictions() == APK_CanPassInRegs; +return getArgPassingRestrictions() == ArgPassingKind::CanPassInRegs; } ArgPassingKind getArgPassingRestrictions() const { @@ -4223,7 +4201,7 @@ class RecordDecl : public TagDecl { } void setArgPassingRestrictions(ArgPassingKind Kind) { -RecordDeclBits.ArgPassingRestrictions = Kind; +RecordDeclBits.ArgPassingRestrictions = llvm::to_underlying(Kind); } bool isParamDestroyedInCallee() const { diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 978e4255e877ec2..ba6dadd7d3563c3 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -1399,6 +1399,29 @@ enum class DeductionCandidate : unsigned char { Aggregate, }; +/// Enum that represents the diff erent ways arguments are passed to and +/// returned from function calls. This takes into account the target-specific +/// and version-specific rules along with the rules determined by the +/// language. +enum class ArgPassingKind { + /// The argument of this type can be passed directly in registers. + CanPassInRegs, + + /// The argument of this type cannot be passed directly in registers. + /// Records containing this type as a subobject are not forced to be passed + /// indirectly. This value is used only in C++. This value is required by + /// C++ because, in uncommon situations, it is possible for a class to have + /// only trivial copy/move constructors even when one of its subobjects has + /// a non-trivial copy/move constructor (if e.g. the corresponding copy/move + /// constructor in the derived class is deleted). + CannotPassInRegs, + + /// The argument of this type cannot be passed directly in registers. + /// Records containing this type as a subobject are forced to be passed + /// indirectly. + CanNeverPassInRegs +}; + /// DeclContext - This is used only as base class of specific decl types that /// can act as declaration contexts. These decls are (only the top classes /// that directly derive from DeclContext are mentioned, not their subclasses): diff --git a/clan
[Lldb-commits] [lldb] f5f4c5b - [clang][NFC] Follow up to ArraySizeModifier refactoring
Author: Vlad Serebrennikov Date: 2023-10-31T18:21:36+03:00 New Revision: f5f4c5b313fc809b9b1b9d600d0ec3cec0d12941 URL: https://github.com/llvm/llvm-project/commit/f5f4c5b313fc809b9b1b9d600d0ec3cec0d12941 DIFF: https://github.com/llvm/llvm-project/commit/f5f4c5b313fc809b9b1b9d600d0ec3cec0d12941.diff LOG: [clang][NFC] Follow up to ArraySizeModifier refactoring This addresses issues found by https://lab.llvm.org/buildbot/#/builders/68/builds/62599 introduced in d71ac4b05bcf2804368ec7217a13c2c47fce7479 Added: Modified: clang-tools-extra/clangd/Hover.cpp libcxxabi/test/test_demangle.pass.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp Removed: diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index 933c69294b40926..7f7b5513dff6fee 100644 --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -686,9 +686,9 @@ getPredefinedExprHoverContents(const PredefinedExpr &PE, ASTContext &Ctx, HI.Type = printType(Name->getType(), Ctx, PP); } else { // Inside templates, the approximate type `const char[]` is still useful. -QualType StringType = Ctx.getIncompleteArrayType( -Ctx.CharTy.withConst(), ArrayType::ArraySizeModifier::Normal, -/*IndexTypeQuals=*/0); +QualType StringType = Ctx.getIncompleteArrayType(Ctx.CharTy.withConst(), + ArraySizeModifier::Normal, + /*IndexTypeQuals=*/0); HI.Type = printType(StringType, Ctx, PP); } return HI; diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp index 77741a952850ab9..3bfdc04ced50b36 100644 --- a/libcxxabi/test/test_demangle.pass.cpp +++ b/libcxxabi/test/test_demangle.pass.cpp @@ -5989,7 +5989,7 @@ const char* cases[][2] = {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE13TransformTypeERNS_14TypeLocBuilderENS_7TypeLocE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformType(clang::TypeLocBuilder&, clang::TypeLoc)"}, {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE27TransformFunctionTypeParamsENS_14SourceLocationEPPNS_11ParmVarDeclEjPKNS_8QualTypeERN4llvm15SmallVectorImplIS8_EEPNSC_IS6_EE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformFunctionTypeParams(clang::SourceLocation, clang::ParmVarDecl**, unsigned int, clang::QualType const*, llvm::SmallVectorImpl&, llvm::SmallVectorImpl*)"}, {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE26TransformFunctionTypeParamEPNS_11ParmVarDeclEN4llvm8OptionalIjEE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformFunctionTypeParam(clang::ParmVarDecl*, llvm::Optional)"}, - {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE16RebuildArrayTypeENS_8QualTypeENS_9ArrayType17ArraySizeModifierEPKN4llvm5APIntEPNS_4ExprEjNS_11SourceRangeE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::RebuildArrayType(clang::QualType, clang::ArrayType::ArraySizeModifier, llvm::APInt const*, clang::Expr*, unsigned int, clang::SourceRange)"}, + {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE16RebuildArrayTypeENS_8QualTypeENS_9ArrayType17ArraySizeModifierEPKN4llvm5APIntEPNS_4ExprEjNS_11SourceRangeE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::RebuildArrayType(clang::QualType, clang::ArraySizeModifier, llvm::APInt const*, clang::Expr*, unsigned int, clang::SourceRange)"}, {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE22TransformReferenceTypeERNS_14TypeLocBuilderENS_16ReferenceTypeLocE", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformReferenceType(clang::TypeLocBuilder&, clang::ReferenceTypeLoc)"}, {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE26TransformTemplateArgumentsINS_33TemplateArgumentLocInventIteratorIS2_PKNS_16TemplateArgumentEbT_SA_RNS_24TemplateArgumentListInfoE", "bool clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformTemplateArguments>(clang::TemplateArgumentLocInventIterator<(anonymous namespace)::CurrentInstantiationRebuilder, clang::TemplateArgument const*>, clang::TemplateArgumentLocInventIterator<(anonymous namespace)::CurrentInstantiationRebuilder, clang::TemplateArgument const*>, clang::TemplateArgumentListInfo&)"}, {"_ZN5clang13TreeTransformIN12_GLOBAL__N_129CurrentInstantiationRebuilderEE25TransformTemplateArgumentERKNS_19TemplateArgumentLocERS4_", "clang::TreeTransform<(anonymous namespace)::CurrentInstantiationRebuilder>::TransformTemplateArgument(clang::T
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
Endilll wrote: @clayborg Thank you for extensive feedback! Can you clarify where do you want me to put the changes? --- You expected the following: > v.SetFormat(lldb.eFormatDecimal) v.GetValue() `1(1)` But my patch doesn't seem to alter the behavior of `eFormatDecimal`. The code and LLDB output with this PR applied are below. ```cpp enum E { E1 = 0 }; int main() { E e; return 0; } ``` ``` * thread #1, name = 'enum_test', stop reason = breakpoint 1.1 frame #0: 0x513b enum_test`main at test.cxx:8:5 5int main() 6{ 7E e; -> 8return 0; 9} (lldb) script Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D. >>> lldb.frame.FindVariable("e") (E) e = E1(0) >>> e = lldb.frame.FindVariable("e") >>> e.SetFormat(lldb.eFormatDecimal) >>> e (E) e = 0 >>> e.GetValue() '0' >>> e.GetSummary() >>> ``` --- I'm also wondering if refactoring this patch to use summaries is going to affect the way we dump enum *types* (with enumerators included). Apparently, this is covered by `TestRustEnumStructs.py` test that I change in this PR. https://github.com/llvm/llvm-project/pull/69815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
@@ -23,9 +23,18 @@ def check_enum(self, suffix): substrs=["Case1", "Case2", "Case3"], ) # Test each case in the enum. -self.expect_expr("var1_" + suffix, result_type=enum_name, result_value="Case1") -self.expect_expr("var2_" + suffix, result_type=enum_name, result_value="Case2") -self.expect_expr("var3_" + suffix, result_type=enum_name, result_value="Case3") +self.expect( +"expr var1_" + suffix, +patterns=[f"\\({enum_name}\\) \\$\\d+ = Case1\\(-?\\d+\\)"], +) +self.expect( +"expr var2_" + suffix, +patterns=[f"\\({enum_name}\\) \\$\\d+ = Case2\\(-?\\d+\\)"], +) +self.expect( +"expr var3_" + suffix, +patterns=[f"\\({enum_name}\\) \\$\\d+ = Case3\\(-?\\d+\\)"], Endilll wrote: I tried to do that initially, but then I realized that actual values of `Case1`, `Case2`, and `Case3` differ on invocations of this function. It might not be apparent at the first glance, but those asserts are a part of `check_enum` function which is called 10 times at the end of this file. https://github.com/llvm/llvm-project/pull/69815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
Endilll wrote: > What happens with values that don't have a name, do we already have a > fallback for that? I think we do: https://github.com/llvm/llvm-project/blob/2ad9fde41839879d8805d430c2e0857466d9c5d6/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L8563-L8571 Later there is a fallback for `can_be_bitfield == true` code path: https://github.com/llvm/llvm-project/blob/2ad9fde41839879d8805d430c2e0857466d9c5d6/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L8597-L8599 https://github.com/llvm/llvm-project/pull/69815 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/69815 >From 886c627b8675886cfa09745c2441e3ab4aaadaea Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sat, 21 Oct 2023 09:18:24 +0300 Subject: [PATCH 1/3] [lldb] Add number to enumerator dump --- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TestCastIntToAnonymousEnum.py | 2 +- .../API/lang/c/enum_types/TestEnumTypes.py| 10 +- .../TestConstStaticIntegralMember.py | 20 +-- .../lang/cpp/enum_types/TestCPP11EnumTypes.py | 6 +++--- .../rust/enum-structs/TestRustEnumStructs.py | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f1353db2631ddc6..b1ec1cf9a322907 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType &qual_type, Stream &s, ++num_enumerators; if (val == enum_svalue) { // Found an exact match, that's all we need to do. - s.PutCString(enumerator->getNameAsString()); + s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), enum_svalue); return true; } } diff --git a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py index 923f021d53399cb..00610a29353423f 100644 --- a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py +++ b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py @@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self): self, "// break here", lldb.SBFileSpec("main.cpp", False) ) -self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A") +self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A(0)") diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py index 33a846c50d7def3..e69cefee2540d47 100644 --- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py @@ -22,12 +22,12 @@ def test_command_line(self): self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c") ) -self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A$"]) -self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B$"]) -self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C$"]) -self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB$"]) +self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A\\(1\\)$"]) +self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B\\(2\\)$"]) +self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C\\(4\\)$"]) +self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB\\(3\\)$"]) self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A | C$"]) -self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL$"]) +self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL\\(7\\)$"]) # Test that an enum that doesn't match the heuristic we use in # TypeSystemClang::DumpEnumValue, gets printed as a raw integer. self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 7$"]) diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py index 530191e8a37ba1b..80e81c0df8a5bfd 100644 --- a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py +++ b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py @@ -57,12 +57,12 @@ def test(self): self.expect_expr("A::wchar_min == wchar_min", result_value="true") # Test an unscoped enum. -self.expect_expr("A::enum_val", result_value="enum_case2") +self.expect_expr("A::enum_val", result_value="enum_case2(2)") # Test an unscoped enum with bool as the underlying type. -self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1") +self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1(0)") # Test a scoped enum. -self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2") +self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2(2)") # Test an scoped enum with a value that isn't an enumerator. self.expect_expr(
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/69815 >From 886c627b8675886cfa09745c2441e3ab4aaadaea Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sat, 21 Oct 2023 09:18:24 +0300 Subject: [PATCH 1/2] [lldb] Add number to enumerator dump --- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TestCastIntToAnonymousEnum.py | 2 +- .../API/lang/c/enum_types/TestEnumTypes.py| 10 +- .../TestConstStaticIntegralMember.py | 20 +-- .../lang/cpp/enum_types/TestCPP11EnumTypes.py | 6 +++--- .../rust/enum-structs/TestRustEnumStructs.py | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f1353db2631ddc6..b1ec1cf9a322907 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType &qual_type, Stream &s, ++num_enumerators; if (val == enum_svalue) { // Found an exact match, that's all we need to do. - s.PutCString(enumerator->getNameAsString()); + s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), enum_svalue); return true; } } diff --git a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py index 923f021d53399cb..00610a29353423f 100644 --- a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py +++ b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py @@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self): self, "// break here", lldb.SBFileSpec("main.cpp", False) ) -self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A") +self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A(0)") diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py index 33a846c50d7def3..e69cefee2540d47 100644 --- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py @@ -22,12 +22,12 @@ def test_command_line(self): self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c") ) -self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A$"]) -self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B$"]) -self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C$"]) -self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB$"]) +self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A\\(1\\)$"]) +self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B\\(2\\)$"]) +self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C\\(4\\)$"]) +self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB\\(3\\)$"]) self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A | C$"]) -self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL$"]) +self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL\\(7\\)$"]) # Test that an enum that doesn't match the heuristic we use in # TypeSystemClang::DumpEnumValue, gets printed as a raw integer. self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 7$"]) diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py index 530191e8a37ba1b..80e81c0df8a5bfd 100644 --- a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py +++ b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py @@ -57,12 +57,12 @@ def test(self): self.expect_expr("A::wchar_min == wchar_min", result_value="true") # Test an unscoped enum. -self.expect_expr("A::enum_val", result_value="enum_case2") +self.expect_expr("A::enum_val", result_value="enum_case2(2)") # Test an unscoped enum with bool as the underlying type. -self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1") +self.expect_expr("A::enum_bool_val", result_value="enum_bool_case1(0)") # Test a scoped enum. -self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2") +self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2(2)") # Test an scoped enum with a value that isn't an enumerator. self.expect_expr(
[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/69815 This patch adds the value to enumerator dump, e.g. `Enumerator` now dumped as `Enumerator(0)`. There are not-so-uncommon cases when value of enumerator is no less important than its name. One example can be found in https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/clang/include/clang/AST/DeclarationName.h#L183 Another one, number of bits to shift, can be found in https://github.com/llvm/llvm-project/blob/4aae5387a874a55ee491f5dc23ce0506c5cdc678/llvm/include/llvm/ADT/PointerIntPair.h#L181 >From 886c627b8675886cfa09745c2441e3ab4aaadaea Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sat, 21 Oct 2023 09:18:24 +0300 Subject: [PATCH] [lldb] Add number to enumerator dump --- .../TypeSystem/Clang/TypeSystemClang.cpp | 2 +- .../TestCastIntToAnonymousEnum.py | 2 +- .../API/lang/c/enum_types/TestEnumTypes.py| 10 +- .../TestConstStaticIntegralMember.py | 20 +-- .../lang/cpp/enum_types/TestCPP11EnumTypes.py | 6 +++--- .../rust/enum-structs/TestRustEnumStructs.py | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f1353db2631ddc6..b1ec1cf9a322907 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -8550,7 +8550,7 @@ static bool DumpEnumValue(const clang::QualType &qual_type, Stream &s, ++num_enumerators; if (val == enum_svalue) { // Found an exact match, that's all we need to do. - s.PutCString(enumerator->getNameAsString()); + s.Printf("%s(%" PRIi64 ")", enumerator->getNameAsString().c_str(), enum_svalue); return true; } } diff --git a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py index 923f021d53399cb..00610a29353423f 100644 --- a/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py +++ b/lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py @@ -18,4 +18,4 @@ def test_cast_int_to_anonymous_enum(self): self, "// break here", lldb.SBFileSpec("main.cpp", False) ) -self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A") +self.expect_expr("(flow_e)0", result_type="flow_e", result_value="A(0)") diff --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py index 33a846c50d7def3..e69cefee2540d47 100644 --- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py @@ -22,12 +22,12 @@ def test_command_line(self): self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c") ) -self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A$"]) -self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B$"]) -self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C$"]) -self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB$"]) +self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A\\(1\\)$"]) +self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B\\(2\\)$"]) +self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C\\(4\\)$"]) +self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB\\(3\\)$"]) self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A | C$"]) -self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL$"]) +self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL\\(7\\)$"]) # Test that an enum that doesn't match the heuristic we use in # TypeSystemClang::DumpEnumValue, gets printed as a raw integer. self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 7$"]) diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py index 530191e8a37ba1b..80e81c0df8a5bfd 100644 --- a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py +++ b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py @@ -57,12 +57,12 @@ def test(self): self.expect_expr("A::wchar_min == wchar_min", result_value="true") # Test an unscoped enum. -self.expect_expr("A::enum_val", result_value="enum_case2") +self.expect_expr("A::enum_val", result_value="enum_case2(2
[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Resolve nested types when parsing structures (PR #66879)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/66879 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Resolve nested types when parsing structures (PR #66879)
Endilll wrote: Superseded by #68705 https://github.com/llvm/llvm-project/pull/66879 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
https://github.com/Endilll closed https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
@@ -720,6 +720,14 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a directly nested type that has provided name. Endilll wrote: Done https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindDirectNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this, name); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindDirectNestedType(name)); + return ret; Endilll wrote: Sure. It was a leftover from debugging. https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 01/15] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
@@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); Endilll wrote: Done! https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
@@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); Endilll wrote: I followed @Michael137 suggestion that `TypeImpl::FindDirectNestedType` should accept `llvm::StringRef` instead. This should be addressed now. https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 01/14] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem
[Lldb-commits] [lldb] [lldb] Add SBType::FindDirectNestedType() function (PR #68705)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -8,6 +8,9 @@ class Task { TASK_TYPE_1, TASK_TYPE_2 } type; +enum E : unsigned char {} e; +union U { +} u; Endilll wrote: Done! https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 01/13] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -119,6 +119,38 @@ def test(self): self.assertEqual(task_type, task_head_pointee_type) +# Check whether we can find a directly nested type by name +name_type = task_type.FindDirectNestedType("name") +self.assertTrue(name_type) +self.DebugSBType(name_type) + +enum_type = task_type.FindDirectNestedType("E") +self.assertTrue(enum_type) +self.DebugSBType(enum_type) + +union_type = task_type.FindDirectNestedType("U") +self.assertTrue(union_type) +self.DebugSBType(union_type) + +# Check that we don't find indirectly nested types + +self.assertTrue(enum_type.size == 1) Endilll wrote: At the moment we don't have an API to get (direct) `DeclContext` of a type, as far as I know. So I made enums distinct by using underlying type of different size. https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 01/12] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); Endilll wrote: @jimingham @Michael137 Any opinions? https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -186,6 +186,11 @@ std::optional TypeSystem::ReportStatistics() { return std::nullopt; } +CompilerDeclContext Endilll wrote: Both items are done! https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 01/11] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 1/8] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem {
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -119,6 +119,15 @@ def test(self): self.assertEqual(task_type, task_head_pointee_type) +# Check whether we can find a nested type by name +name_type = task_type.FindNestedType("name") +self.assertTrue(name_type) +self.DebugSBType(name_type) + Endilll wrote: I pushed an update. Can you take a look again? https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/68705 >From ca4d1bbdeb4ea541199e3db3518b35eb2d5a8cad Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 10 Oct 2023 15:07:56 +0300 Subject: [PATCH 1/7] [lldb] Add SBType::FindNestedType() function --- lldb/bindings/interface/SBTypeDocstrings.i | 7 +++ lldb/include/lldb/API/SBType.h | 2 ++ lldb/include/lldb/Symbol/Type.h | 2 ++ lldb/include/lldb/Symbol/TypeSystem.h | 4 lldb/source/API/SBType.cpp | 9 + .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp| 4 .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 2 ++ lldb/source/Symbol/Type.cpp | 13 + lldb/source/Symbol/TypeSystem.cpp | 4 9 files changed, 47 insertions(+) diff --git a/lldb/bindings/interface/SBTypeDocstrings.i b/lldb/bindings/interface/SBTypeDocstrings.i index 96421a6aa20104b..b4ec67da957c7d4 100644 --- a/lldb/bindings/interface/SBTypeDocstrings.i +++ b/lldb/bindings/interface/SBTypeDocstrings.i @@ -720,6 +720,13 @@ SBType supports the eq/ne operator. For example,:: " ) lldb::SBType::GetTypeFlags; +%feature("docstring", +"Searches for a nested type that has provided name. + +Returns the type if it was found. +Returns invalid type if nothing was found." +) lldb::SBType::FindNestedType; + %feature("docstring", "Represents a list of :py:class:`SBType` s. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 5962f0c50dee14f..fa02197ff8f3940 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -215,6 +215,8 @@ class SBType { bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level); + lldb::SBType FindNestedType(const char *name); + lldb::SBType &operator=(const lldb::SBType &rhs); bool operator==(lldb::SBType &rhs); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 046501931d211a7..6da4aaba401fe14 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -313,6 +313,8 @@ class TypeImpl { bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level); + CompilerType FindNestedType(ConstString name); + private: bool CheckModule(lldb::ModuleSP &module_sp) const; bool CheckExeModule(lldb::ModuleSP &module_sp) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index eb6e453e1aec0d0..b503b66eb528c68 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -135,6 +135,10 @@ class TypeSystem : public PluginInterface, virtual lldb::LanguageType DeclContextGetLanguage(void *opaque_decl_ctx) = 0; + // CompilerType functions + + virtual CompilerDeclContext GetCompilerDeclContextForType(const CompilerType& type); + // Tests #ifndef NDEBUG /// Verify the integrity of the type to catch CompilerTypes that mix diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index ee5b6447428098e..7fe1836ea5d670b 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -586,6 +586,15 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { return eTemplateArgumentKindNull; } +SBType SBType::FindNestedType(const char *name) { + LLDB_INSTRUMENT_VA(this); + + if (!IsValid()) +return SBType(); + auto ret = SBType(m_opaque_sp->FindNestedType(ConstString(name))); + return ret; +} + SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) { LLDB_INSTRUMENT_VA(this); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69cff0f35ae4ab2..b4bf3d3fdb20c1e 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2636,6 +2636,10 @@ TypeSystemClang::GetDeclContextForType(const CompilerType &type) { return GetDeclContextForType(ClangUtil::GetQualType(type)); } +CompilerDeclContext TypeSystemClang::GetCompilerDeclContextForType(const CompilerType& type) { + return CreateDeclContext(GetDeclContextForType(type)); +} + /// Aggressively desugar the provided type, skipping past various kinds of /// syntactic sugar and other constructs one typically wants to ignore. /// The \p mask argument allows one to skip certain kinds of simplifications, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 0544de3cd33befb..806ff64ef0af76b 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -219,6 +219,8 @@ class TypeSystemClang : public TypeSystem {
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -1082,6 +1082,19 @@ bool TypeImpl::GetDescription(lldb_private::Stream &strm, return true; } +CompilerType TypeImpl::FindNestedType(ConstString name) { Endilll wrote: Done! https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)
@@ -119,6 +119,11 @@ def test(self): self.assertEqual(task_type, task_head_pointee_type) +# Check whether we can find a nested type by name +name_type = task_type.FindNestedType("name") Endilll wrote: Done! https://github.com/llvm/llvm-project/pull/68705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits