[llvm] [PDB] Fix and simplify module index lookup (PR #179869)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 18:32:32 PDT 2026


================
@@ -410,20 +410,16 @@ uint64_t NativeSession::getVAFromSectOffset(uint32_t Section,
 bool NativeSession::moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const {
   ModuleIndex = 0;
   auto Iter = AddrToModuleIndex.find(VA);
-  if (Iter == AddrToModuleIndex.end())
-    return false;
-  ModuleIndex = Iter.value();
-  return true;
+  if (Iter.valid() && !IMap::KeyTraits::startLess(VA, Iter.start())) {
----------------
HaohaiWen wrote:

Yes. I aggress it's easier to read. But I think it's better to use the IntervalMapInfo traits class to determine if a key is contained in an interval.

https://github.com/llvm/llvm-project/pull/179869


More information about the llvm-commits mailing list