Leonard Grey 4c08780e7c
[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
2e34fecf02/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (L2177)
but couldn't repro with local or global (emitted as `S_LDATA32` in both
cases).
2026-02-12 09:35:00 -05:00

25 lines
527 B
Plaintext

# 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