Details
- Reviewers
- None
- Commits
- rG7518e0ff63cd: Avoid using a variable-sized array for a tiny allocation.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/source/Expression/DWARFExpression.cpp | ||
---|---|---|
1309 | Why size and not 8? |
lldb/source/Expression/DWARFExpression.cpp | ||
---|---|---|
1309 | Because that preserves the semantics of the original code. The original code allocates anywhere from 1 to 8 bytes, based on size `uint8_t addr_bytes[size];`. Then reads that amount from memory (line 1303 - 1304), and then passes the size of the allocation on this line (via `sizeof(addr_bytes)`). Always passing eight here would be wrong, because the size of the pointer could have been anywhere from 1 to 8. Not also how line 1309 read size-bytes read into addr_bytes. |
Why size and not 8?