[PATCH] Fix DWARFContext::getCompileUnitForOffset().

Frederic Riss friss at apple.com
Tue Sep 9 05:05:59 PDT 2014


Hi dblaikie, samsonov,

The header comment for this funtction states that it is usable to find the
CompileUnit containing a given offset, but right now it only works for exact
start offsets of the Units.

To generalize it to any offset, change the comparator function to compare
against the Unit->getNextUnitOffset() and change the search function from
lower_bound to upper_bound. This way, the returned unit is the first one
where Unit->getNextUnitOffset() is strictly greater than the searched offset
which is exactly what we want.

Further patches will use this generalized function to lookup cross-unit
references, and test coverage for this fix will then come naturally through
the tests for that new functionality.

http://reviews.llvm.org/D5262

Files:
  lib/DebugInfo/DWARFContext.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5262.13452.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140909/eefb9713/attachment.bin>


More information about the llvm-commits mailing list