]> granicus.if.org Git - clang/commitdiff
CodeGen: Move DebugLocs.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 7 Feb 2015 13:15:54 +0000 (13:15 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 7 Feb 2015 13:15:54 +0000 (13:15 +0000)
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

lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDebugInfo.cpp

index b0b30a6133a459fad72750af63cf3cdacb022ff9..3c296ae468163b79455ed4fdff27ac124f5257ff 100644 (file)
@@ -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) {
index c5f358f7a1b27e1524f226c0d21572eaefa76a52..530797d15bf78e6025cf1081d09ef82128804dff 100644 (file)
@@ -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