]> granicus.if.org Git - llvm/commitdiff
[PGO] Fix a use-after-move. NFC.
authorRong Xu <xur@google.com>
Wed, 19 Oct 2016 23:31:59 +0000 (23:31 +0000)
committerRong Xu <xur@google.com>
Wed, 19 Oct 2016 23:31:59 +0000 (23:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284664 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-profdata/llvm-profdata.cpp

index b9e30255ae399205cb4561d8d4b156e05486b1f5..6715566a166c2915443db8821f3172a8945c730e 100644 (file)
@@ -158,13 +158,14 @@ static void loadInput(const WeightedFile &Input, WriterContext *WC) {
   }
 
   for (auto &I : *Reader) {
+    const StringRef FuncName = I.Name;
     if (Error E = WC->Writer.addRecord(std::move(I), Input.Weight)) {
       // Only show hint the first time an error occurs.
       instrprof_error IPE = InstrProfError::take(std::move(E));
       std::unique_lock<std::mutex> ErrGuard{WC->ErrLock};
       bool firstTime = WC->WriterErrorCodes.insert(IPE).second;
       handleMergeWriterError(make_error<InstrProfError>(IPE), Input.Filename,
-                             I.Name, firstTime);
+                             FuncName, firstTime);
     }
   }
   if (Reader->hasError())