From 3cff19be36fc5ec3322a635df3304da487b5b946 Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Thu, 2 Aug 2018 18:17:01 +0000 Subject: [PATCH] [analyzer] Forward arguments in registerChecker to avoid accidental copies Differential Revision: https://reviews.llvm.org/D50108 llvm-svn: 338753 --- clang/include/clang/StaticAnalyzer/Core/CheckerManager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h index 7c35332..ea2952b 100644 --- a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -149,13 +149,13 @@ public: /// /// \returns a pointer to the checker object. template - CHECKER *registerChecker(AT... Args) { + CHECKER *registerChecker(AT &&... Args) { CheckerTag tag = getTag(); CheckerRef &ref = CheckerTags[tag]; if (ref) return static_cast(ref); // already registered. - CHECKER *checker = new CHECKER(Args...); + CHECKER *checker = new CHECKER(std::forward(Args)...); checker->Name = CurrentCheckName; CheckerDtors.push_back(CheckerDtor(checker, destruct)); CHECKER::_register(checker, *this); -- 2.7.4