[Lldb-commits] [lldb] [LLDB][NativePDB] Use typedef compiler type for typedef types (PR #156250)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Aug 31 09:05:14 PDT 2025
================
@@ -0,0 +1,128 @@
+// REQUIRES: lld
+
+// Test that simple types can be found
+// RUN: %build --std=c++20 --nodefaultlib --compiler=clang-cl --arch=64 -o %t.exe -- %s
+// RUN: lldb-test symbols %t.exe | FileCheck %s
+
+bool *PB;
+bool &RB = *PB;
+bool *&RPB = PB;
+const bool &CRB = RB;
+bool *const BC = 0;
+const bool *const CBC = 0;
+
+long AL[2];
+
+const volatile short CVS = 0;
+const short CS = 0;
+volatile short VS;
+
+struct ReturnedStruct1 {};
+struct ReturnedStruct2 {};
+
+struct MyStruct {
+ static ReturnedStruct1 static_fn(char *) { return {}; }
+ ReturnedStruct2 const_member_fn(char *) const { return {}; }
+ void volatile_member_fn() volatile {};
+ void member_fn() {};
+};
+
+void (*PF)(int, bool *, const float, ...);
+
+using Func = void(char16_t, MyStruct &);
+Func *PF2;
+
+using SomeTypedef = long;
+SomeTypedef ST;
+
+int main() {
+ bool b;
+ char c;
+ unsigned char uc;
+ char8_t c8;
+
+ short s;
+ unsigned short us;
+ wchar_t wc;
+ char16_t c16;
+
+ int i;
+ unsigned int ui;
+ long l;
+ unsigned long ul;
+ char32_t c32;
+
+ long long ll;
+ unsigned long long ull;
+
+ float f;
+ double d;
+
+ MyStruct my_struct;
+
+ decltype(nullptr) np;
+}
+
+// CHECK-DAG: Type{{.*}} , name = "std::nullptr_t", size = 0, compiler_type = 0x{{[0-9a-f]+}} nullptr_t
----------------
Nerixyz wrote:
Here, the size of this type is 0. This is explicitly set in the code. The DIA plugin doesn't set the size to 0 if types are unsized (e.g. the function types below).
I'm not sure if it's bad that the native plugin sets this to 0. When calling [`Type::GetByteSize`, the size is set to 0 anyway](https://github.com/llvm/llvm-project/blob/d63dd5eed0ea2f34bcf8b178211f8771ea75dec7/lldb/source/Symbol/Type.cpp#L489-L490) (because the compiler type would return 0 there).
https://github.com/llvm/llvm-project/pull/156250
More information about the lldb-commits
mailing list