[llvm] r290298 - Clear the PendingTypeTests vector after moving from it.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 18:52:23 PST 2016


Author: pcc
Date: Wed Dec 21 20:52:23 2016
New Revision: 290298

URL: http://llvm.org/viewvc/llvm-project?rev=290298&view=rev
Log:
Clear the PendingTypeTests vector after moving from it.

This is to put the vector into a well defined state. Apparently the state of a
vector after being moved from is valid but unspecified. Found with clang-tidy.

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=290298&r1=290297&r2=290298&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Dec 21 20:52:23 2016
@@ -4915,6 +4915,7 @@ Error ModuleSummaryIndexBitcodeReader::p
       auto FS = llvm::make_unique<FunctionSummary>(
           Flags, InstCount, std::move(Refs), std::move(Calls),
           std::move(PendingTypeTests));
+      PendingTypeTests.clear();
       auto GUID = getGUIDFromValueId(ValueID);
       FS->setModulePath(TheIndex.addModulePath(ModulePath, 0)->first());
       FS->setOriginalName(GUID.second);
@@ -4989,6 +4990,7 @@ Error ModuleSummaryIndexBitcodeReader::p
       auto FS = llvm::make_unique<FunctionSummary>(
           Flags, InstCount, std::move(Refs), std::move(Edges),
           std::move(PendingTypeTests));
+      PendingTypeTests.clear();
       LastSeenSummary = FS.get();
       FS->setModulePath(ModuleIdMap[ModuleId]);
       TheIndex.addGlobalValueSummary(GUID, std::move(FS));




More information about the llvm-commits mailing list