Remove code in the form of "return std::move(local_var);"

Change the code to "return local_var;" instead. When the compiler
complains about return statements with a ternary operator, convert that
to an if statement with 2 returns, to make the code compile without the
std::move().

Change-Id: I794c7cce9fb25c4a785e847231c55061733b5817
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/115810
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 80d2698..b5a0c1f 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -32,7 +32,10 @@
     pdfium::span<const uint8_t> span) {
   auto pDoc = std::make_unique<CFDF_Document>();
   pDoc->ParseStream(pdfium::MakeRetain<CFX_ReadOnlySpanStream>(span));
-  return pDoc->m_pRootDict ? std::move(pDoc) : nullptr;
+  if (!pDoc->m_pRootDict) {
+    return nullptr;
+  }
+  return pDoc;
 }
 
 void CFDF_Document::ParseStream(RetainPtr<IFX_SeekableReadStream> pFile) {
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index e72d393..76b0dbc 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -640,7 +640,7 @@
     pObj->SetGenNum(parser_gennum);
   }
 
-  return GetValidator()->has_read_problems() ? nullptr : std::move(pObj);
+  return GetValidator()->has_read_problems() ? nullptr : pObj;
 }
 
 unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
diff --git a/core/fxcodec/basic/basicmodule.cpp b/core/fxcodec/basic/basicmodule.cpp
index 384c214..bb19d75 100644
--- a/core/fxcodec/basic/basicmodule.cpp
+++ b/core/fxcodec/basic/basicmodule.cpp
@@ -224,7 +224,7 @@
   if (!pDecoder->Create(src_buf, width, height, nComps, bpc))
     return nullptr;
 
-  return std::move(pDecoder);
+  return pDecoder;
 }
 
 // static
diff --git a/core/fxcodec/jpeg/jpegmodule.cpp b/core/fxcodec/jpeg/jpegmodule.cpp
index 609ef8d..a34388d 100644
--- a/core/fxcodec/jpeg/jpegmodule.cpp
+++ b/core/fxcodec/jpeg/jpegmodule.cpp
@@ -389,7 +389,7 @@
   if (!pDecoder->Create(src_span, width, height, nComps, ColorTransform))
     return nullptr;
 
-  return std::move(pDecoder);
+  return pDecoder;
 }
 
 // static
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index 07fba43..88b63eb 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -87,7 +87,10 @@
   auto doc = std::make_unique<CFX_XMLDocument>();
   AutoRestorer<UnownedPtr<CFX_XMLNode>> restorer(&current_node_);
   current_node_ = doc->GetRoot();
-  return DoSyntaxParse(doc.get()) ? std::move(doc) : nullptr;
+  if (!DoSyntaxParse(doc.get())) {
+    return nullptr;
+  }
+  return doc;
 }
 
 bool CFX_XMLParser::DoSyntaxParse(CFX_XMLDocument* doc) {
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 492adc4..41191a9 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -149,7 +149,7 @@
     pInfo->AddPath("/Library/Fonts");
     pInfo->AddPath("/System/Library/Fonts");
   }
-  return std::move(pInfo);
+  return pInfo;
 }
 
 void* CApplePlatform::CreatePlatformFont(
diff --git a/core/fxge/win32/cwin32_platform.cpp b/core/fxge/win32/cwin32_platform.cpp
index 40774fd..7fa9b3e 100644
--- a/core/fxge/win32/cwin32_platform.cpp
+++ b/core/fxge/win32/cwin32_platform.cpp
@@ -462,7 +462,7 @@
     auto font_info = std::make_unique<CFX_Win32FallbackFontInfo>();
     for (; *user_paths; user_paths++)
       font_info->AddPath(*user_paths);
-    return std::move(font_info);
+    return font_info;
   }
 
   if (pdfium::IsUser32AndGdi32Available()) {
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index 527720e..6640737 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -28,7 +28,7 @@
   auto pWnd = std::make_unique<CPWL_CheckBox>(cp, std::move(pAttachedData));
   pWnd->Realize();
   pWnd->SetCheck(m_pWidget->IsChecked());
-  return std::move(pWnd);
+  return pWnd;
 }
 
 bool CFFL_CheckBox::OnKeyDown(FWL_VKEYCODE nKeyCode,
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 7364135..fa53cc8 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -55,7 +55,7 @@
 
   pWnd->SetSelect(nCurSel);
   pWnd->SetText(swText);
-  return std::move(pWnd);
+  return pWnd;
 }
 
 bool CFFL_ComboBox::OnChar(CPDFSDK_Widget* pWidget,
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index e943b90..2989840 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -73,7 +73,7 @@
   }
 
   pWnd->SetTopVisibleIndex(m_pWidget->GetTopVisibleIndex());
-  return std::move(pWnd);
+  return pWnd;
 }
 
 bool CFFL_ListBox::OnChar(CPDFSDK_Widget* pWidget,
diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp
index 28892b0..35fb49c 100644
--- a/fpdfsdk/formfiller/cffl_pushbutton.cpp
+++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp
@@ -22,5 +22,5 @@
     std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData) {
   auto pWnd = std::make_unique<CPWL_PushButton>(cp, std::move(pAttachedData));
   pWnd->Realize();
-  return std::move(pWnd);
+  return pWnd;
 }
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 9d11e86..40b42c2 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -28,7 +28,7 @@
   auto pWnd = std::make_unique<CPWL_RadioButton>(cp, std::move(pAttachedData));
   pWnd->Realize();
   pWnd->SetCheck(m_pWidget->IsChecked());
-  return std::move(pWnd);
+  return pWnd;
 }
 
 bool CFFL_RadioButton::OnKeyDown(FWL_VKEYCODE nKeyCode,
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 8096c82..7835ec2 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -97,7 +97,7 @@
     }
   }
   pWnd->SetText(swValue);
-  return std::move(pWnd);
+  return pWnd;
 }
 
 bool CFFL_TextField::OnChar(CPDFSDK_Widget* pWidget,