[clang] [Clang][NFC] Use std::move for Detail in timeTraceMetadata (PR #138352)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 15:00:07 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged the use of Detail because we were not using std::move when returning values. Modified the returns to use std::move.

---
Full diff: https://github.com/llvm/llvm-project/pull/138352.diff


1 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Core/CoreEngine.cpp (+3-2) 


``````````diff
diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 5c05c9c87f124..8ba304b3af0ca 100644
--- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -199,14 +199,15 @@ static llvm::TimeTraceMetadata timeTraceMetadata(const ExplodedNode *Pred,
   }
   auto SLoc = Loc.getSourceLocation();
   if (!SLoc)
-    return llvm::TimeTraceMetadata{Detail, ""};
+    return llvm::TimeTraceMetadata{std::move(Detail), ""};
   const auto &SM = Pred->getLocationContext()
                        ->getAnalysisDeclContext()
                        ->getASTContext()
                        .getSourceManager();
   auto Line = SM.getPresumedLineNumber(*SLoc);
   auto Fname = SM.getFilename(*SLoc);
-  return llvm::TimeTraceMetadata{Detail, Fname.str(), static_cast<int>(Line)};
+  return llvm::TimeTraceMetadata{std::move(Detail), Fname.str(),
+                                 static_cast<int>(Line)};
 }
 
 void CoreEngine::dispatchWorkItem(ExplodedNode *Pred, ProgramPoint Loc,

``````````

</details>


https://github.com/llvm/llvm-project/pull/138352


More information about the cfe-commits mailing list