[PATCH] D158438: [DwarfDebug][NFC] Factor out 'isInitialized' logic

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 12:15:39 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32223123d364: [DwarfDebug][NFC] Factor out 'isInitialized' logic (authored by fdeazeve).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158438/new/

https://reviews.llvm.org/D158438

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h


Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -136,10 +136,13 @@
   DbgVariable(const DILocalVariable *V, const DILocation *IA)
       : DbgEntity(V, IA, DbgVariableKind) {}
 
+  bool isInitialized() const {
+    return !FrameIndexExprs.empty() || ValueLoc;
+  }
+
   /// Initialize from the MMI table.
   void initializeMMI(const DIExpression *E, int FI) {
-    assert(FrameIndexExprs.empty() && "Already initialized?");
-    assert(!ValueLoc.get() && "Already initialized?");
+    assert(!isInitialized() && "Already initialized?");
 
     assert((!E || E->isValid()) && "Expected valid expression");
     assert(FI != std::numeric_limits<int>::max() && "Expected valid index");
@@ -149,8 +152,7 @@
 
   // Initialize variable's location.
   void initializeDbgValue(DbgValueLoc Value) {
-    assert(FrameIndexExprs.empty() && "Already initialized?");
-    assert(!ValueLoc && "Already initialized?");
+    assert(!isInitialized() && "Already initialized?");
     assert(!Value.getExpression()->isFragment() && "Fragments not supported.");
 
     ValueLoc = std::make_unique<DbgValueLoc>(Value);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158438.552098.patch
Type: text/x-patch
Size: 1260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230821/db83b2b7/attachment.bin>


More information about the llvm-commits mailing list