DWARFYAML::emitDebugSections - fix use after std::move warnings. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 20 Sep 2020 13:42:36 +0000 (14:42 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 20 Sep 2020 13:42:36 +0000 (14:42 +0100)
We were using Err after it had been moved into cantFail - avoid this by calling cantFail with Error::success() directly.

llvm/lib/ObjectYAML/DWARFEmitter.cpp

index b634f7c..eaf68df 100644 (file)
@@ -1033,9 +1033,10 @@ DWARFYAML::emitDebugSections(StringRef YAMLString, bool IsLittleEndian,
   if (YIn.error())
     return createStringError(YIn.error(), GeneratedDiag.getMessage());
 
+  cantFail(Error::success());
+
   StringMap<std::unique_ptr<MemoryBuffer>> DebugSections;
   Error Err = Error::success();
-  cantFail(std::move(Err));
 
   for (StringRef SecName : DI.getNonEmptySectionNames())
     Err = joinErrors(std::move(Err),