From: Benjamin Kramer Date: Sat, 7 Feb 2015 13:15:54 +0000 (+0000) Subject: CodeGen: Move DebugLocs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=887264b15650af1832f5ef1a56e8c7502edaa85e;p=clang CodeGen: Move DebugLocs. It's slightly cheaper than copying it, if the DebugLoc points to replaceable metadata every copy is recorded in a DenseMap, moving reduces the peak size of that map. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228492 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index b0b30a6133..3c296ae468 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -2342,7 +2342,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI, } if (!RetDbgLoc.isUnknown()) - Ret->setDebugLoc(RetDbgLoc); + Ret->setDebugLoc(std::move(RetDbgLoc)); } static bool isInAllocaArgument(CGCXXABI &ABI, QualType type) { diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index c5f358f7a1..530797d15b 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -93,7 +93,7 @@ ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc) if (CGF.getDebugInfo()) { OriginalLocation = CGF.Builder.getCurrentDebugLocation(); if (!Loc.isUnknown()) - CGF.Builder.SetCurrentDebugLocation(Loc); + CGF.Builder.SetCurrentDebugLocation(std::move(Loc)); } } @@ -101,7 +101,7 @@ ApplyDebugLocation::~ApplyDebugLocation() { // Query CGF so the location isn't overwritten when location updates are // temporarily disabled (for C++ default function arguments) if (CGF.getDebugInfo()) - CGF.Builder.SetCurrentDebugLocation(OriginalLocation); + CGF.Builder.SetCurrentDebugLocation(std::move(OriginalLocation)); } /// ArtificialLocation - An RAII object that temporarily switches to