[PATCH] D41146: [DWARF] DWARF v5: Rework of string offsets table reader

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 15:59:57 PST 2017


probinson added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:113
+              if (!L)
+                return true; // Invalid L should always precede R.
+              if (R)
----------------
aprantl wrote:
> Not sure if this matters, but won't this be nondeterministic when both L and R are invalid?
I think the most compact code would be
```
if (L && R) return L->base < R->base;
return R;
```
if both are valid, order depends on the base.
if L is invalid and R valid, L sorts before R.
if L is valid and R invalid, R sorts before L.
if both are invalid, they are equivalent (test(R,L) == test(L,R)).



https://reviews.llvm.org/D41146





More information about the llvm-commits mailing list