Before this patch, we have to calculate the offset for the current range list entry. This patch helps make the "Offset" field optional.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
You should also have a test case either in this test or D81217 that shows what happens when you use an offset that is either higher than where you are already, or lower.
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
122–124 | I don't think this wants to be an assert - it should be an error, right? If you specify a lower offset than the current position (e.g. 0 for the second set), you want an error since you can't place it there. |
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
122–124 | Yes, I think it should be an error as well. Currently, DWARFYAML doesn't support error handling. If we change one void EmitXXXSection() to Error EmitXXXSection(), we should change them all. Can I do it in a follow-up patch? |
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
122–124 | Oh, I missed that there's an assertion in this area already. Yes, leaving it to a follow-up is fine, but please add a FIXME note in this patch. |
Add one test case when we try to assign an offset that is greater than the number of bytes written already.
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
121–128 | Can ZeroFillBytes cope with a size of zero? If so, this can be simplified to simply: if (DebugRanges.Offset) ZeroFillBytes(OS, *DebugRanges.Offset - CurrOffset); |
- Address comment.
- Add one more testcase when we try to assign an offset that is equal to the number of bytes written.
I don't think this wants to be an assert - it should be an error, right? If you specify a lower offset than the current position (e.g. 0 for the second set), you want an error since you can't place it there.