[PATCH] This phabricator revision is the merge of 4 patches that aim to provide resolving of AT_abstract_origin and AT_specification attributes.

Alexey Samsonov vonosmas at gmail.com
Fri Sep 5 13:46:49 PDT 2014

IIRC, originally getCompileUnitForOffset() was supposed to work only for the exact Offsets (which are returned by DWARFUnit::getOffset()). Now that you're changing it to work for arbitrary offsets, I think it makes more sense to rewrite it as follows:

  if (CUs.empty()) return nullptr;
  auto It = std::upper_bound(CUs.begin(), CUs.end(), Offset, OffsetComparator());
  if (It == CUs.begin()) return nullptr;
  return (It->getOffset <= Offset && Offset < It->getNextUnitOffset()) ? It->get() : nullptr;

and leave the comparator as is. I would rather not play with non-strict comparisons.


More information about the llvm-commits mailing list