[PATCH] D27885: Make a function to correctly extract the DW_AT_high_pc given the low pc value.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 08:38:50 PST 2016


clayborg added a comment.

I will remove the typo fix and move the assignment of the low PC into the if.



================
Comment at: include/llvm/DebugInfo/DWARF/DWARFDie.h:285
   ///
-  /// \returns anm optional absolute section offset value for the attribute.
+  /// \returns an optional absolute section offset value for the attribute.
   Optional<uint64_t> getRangesBaseAttribute() const;
----------------
davide wrote:
> The typo fix may be committed separately, maybe?
Yeah, I can remove this.


================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:266
     return false;
-
-  if (auto HighPCVal = getAttributeValueAsAddress(DW_AT_high_pc)) {
-    // High PC is an address.
-    HighPC = *HighPCVal;
-  } else if (auto Offset = getAttributeValueAsUnsignedConstant(DW_AT_high_pc)) {
-    // High PC is an offset from LowPC.
-    HighPC = LowPC + *Offset;
-  } else
-    return false;
-  return true;
+  LowPC = *LowPcAddr;
+  if (auto HighPcAddr = getHighPC(LowPC)) {
----------------
aprantl wrote:
> should the update be atomically (ie. only update if highpc is available, too)?
I can move the assignment into the if statement below.


https://reviews.llvm.org/D27885





More information about the llvm-commits mailing list