Skip to content

Conversation

@shafik
Copy link
Collaborator

@shafik shafik commented May 2, 2025

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

Static analysis flagged the use of Detail because we were not using std::move
when returning values. Modified the returns to use std::move.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels May 2, 2025
@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Shafik Yaghmour (shafik)

Changes

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 --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,

@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

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 --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,

@shafik shafik merged commit 2df4be2 into llvm:main May 5, 2025
14 checks passed
@shafik shafik deleted the std_move_detail_timeTraceMetadata branch May 5, 2025 20:42
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Static analysis flagged the use of Detail because we were not using
std::move when returning values. Modified the returns to use std::move.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Static analysis flagged the use of Detail because we were not using
std::move when returning values. Modified the returns to use std::move.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants