[llvm] bd20a34 - [Orc] Avoid unused variable warning in builds without asserts

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 02:33:48 PDT 2023


Author: Benjamin Kramer
Date: 2023-03-31T11:32:53+02:00
New Revision: bd20a344bbf813b2c39b57ad1a5248bff915ce25

URL: https://github.com/llvm/llvm-project/commit/bd20a344bbf813b2c39b57ad1a5248bff915ce25
DIFF: https://github.com/llvm/llvm-project/commit/bd20a344bbf813b2c39b57ad1a5248bff915ce25.diff

LOG: [Orc] Avoid unused variable warning in builds without asserts

DebugObjectManagerPlugin.cpp:372:8: error: unused variable 'ItInserted' [-Werror,-Wunused-variable]
  auto ItInserted = Sections.try_emplace(Name, std::move(Section));
       ^

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
index 678a2315e18a..633ed07594ce 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
@@ -370,12 +370,11 @@ Error ELFDebugObject::recordSection(
   if (Error Err = Section->validateInBounds(this->getBuffer(), Name.data()))
     return Err;
   auto ItInserted = Sections.try_emplace(Name, std::move(Section));
-  LLVM_DEBUG({
-    if (!ItInserted.second)
-      dbgs() << "Skipping debug registration for section '" << Name << "' "
-             << "in object " << Buffer->getBufferIdentifier()
-             << " (duplicate name)\n";
-  });
+  if (!ItInserted.second)
+    LLVM_DEBUG(dbgs() << "Skipping debug registration for section '" << Name
+                      << "' "
+                      << "in object " << Buffer->getBufferIdentifier()
+                      << " (duplicate name)\n");
   return Error::success();
 }
 


        


More information about the llvm-commits mailing list