diff options
| author | Leonard Grey <leonard@leonardgrey.com> | 2026-02-12 09:35:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-12 09:35:00 -0500 |
| commit | 4c08780e7c5b7db8ab8c888fe7f97039b44f3c77 (patch) | |
| tree | c44c0e731a467482ad1e4c8c565637044566a698 /lldb/test/Shell | |
| parent | 6da74dded02d9fc06fab99fc8fb99a3e6a1f21c3 (diff) | |
| download | llvm-4c08780e7c5b7db8ab8c888fe7f97039b44f3c77.tar.gz llvm-4c08780e7c5b7db8ab8c888fe7f97039b44f3c77.tar.bz2 llvm-4c08780e7c5b7db8ab8c888fe7f97039b44f3c77.zip | |
[LLDB][NativePDB] Add local constant support (#180612)
This is mostly to support Swift `let`, but I found a way to get MSVC to
emit a local `S_CONSTANT` (see test).
I saw the note about `MakeConstantLocalExpression` at
https://github.com/llvm/llvm-project/blob/2e34fecf02962e4c8477ca88cc5ac9386a0f76bb/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp#L2177
but couldn't repro with local or global (emitted as `S_LDATA32` in both
cases).
Diffstat (limited to 'lldb/test/Shell')
| -rw-r--r-- | lldb/test/Shell/SymbolFile/NativePDB/local-constant.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/local-constant.test b/lldb/test/Shell/SymbolFile/NativePDB/local-constant.test new file mode 100644 index 000000000000..83d376312a29 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/NativePDB/local-constant.test @@ -0,0 +1,24 @@ +# REQUIRES: msvc + +# Test that we can display local S_CONSTANT records. +# MSVC emits S_CONSTANT for static const locals; clang-cl does not. +# RUN: split-file %s %t +# RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %t/main.cpp +# RUN: %lldb -f %t.exe -s %t/commands.input 2>&1 | FileCheck %s + +#--- main.cpp + +int main() { + static const int kConstant = 42; + return kConstant; +} + +#--- commands.input + +settings set stop-line-count-after 0 +break set -n main +run +frame variable +quit + +# CHECK: (const int) {{.*}}kConstant = 42 |
