From 749aeeaf66a483345e12f69cc1f55dad4e997297 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Wed, 31 May 2023 07:20:24 +0800 Subject: [PATCH] [clang][ExtractAPI] Fix -Wpessimizing-move in DeclarationFragments.h (NFC) /Users/jiefu/llvm-project/clang/include/clang/ExtractAPI/DeclarationFragments.h:118:26: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move] Fragments.insert(It, std::move(Fragment(Spelling, Kind, PreciseIdentifier, ^ /Users/jiefu/llvm-project/clang/include/clang/ExtractAPI/DeclarationFragments.h:118:26: note: remove std::move call here Fragments.insert(It, std::move(Fragment(Spelling, Kind, PreciseIdentifier, ^~~~~~~~~~ 1 error generated. --- clang/include/clang/ExtractAPI/DeclarationFragments.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/ExtractAPI/DeclarationFragments.h b/clang/include/clang/ExtractAPI/DeclarationFragments.h index 4c1b830..3b909b0 100644 --- a/clang/include/clang/ExtractAPI/DeclarationFragments.h +++ b/clang/include/clang/ExtractAPI/DeclarationFragments.h @@ -115,8 +115,8 @@ public: FragmentKind Kind, StringRef PreciseIdentifier = "", const Decl *Declaration = nullptr) { - Fragments.insert(It, std::move(Fragment(Spelling, Kind, PreciseIdentifier, - Declaration))); + Fragments.insert(It, Fragment(Spelling, Kind, PreciseIdentifier, + Declaration)); return *this; } -- 2.7.4