[clang] [Clang][NFC] Use std::move for Detail in timeTraceMetadata (PR #138352)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri May 2 14:59:34 PDT 2025
https://github.com/shafik created https://github.com/llvm/llvm-project/pull/138352
Static analysis flagged the use of Detail because we were not using std::move when returning values. Modified the returns to use std::move.
>From f12ee9b85d6f457061b7976ef929e3547c510b06 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Fri, 2 May 2025 14:55:38 -0700
Subject: [PATCH] [Clang][NFC] Use std::move for Detail in timeTraceMetadata
Static analysis flagged the use of Detail because we were not using std::move
when returning values. Modified the returns to use std::move.
---
clang/lib/StaticAnalyzer/Core/CoreEngine.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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,
More information about the cfe-commits
mailing list