diff options
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index deb04f1bb36c..f59c906c7b75 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -1,9 +1,8 @@ //===- ValueEnumerator.cpp - Number values and types for bitcode writer ---===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -415,10 +414,8 @@ ValueEnumerator::ValueEnumerator(const Module &M, EnumerateMetadata(&F, MD->getMetadata()); } EnumerateType(I.getType()); - if (const CallInst *CI = dyn_cast<CallInst>(&I)) - EnumerateAttributes(CI->getAttributes()); - else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) - EnumerateAttributes(II->getAttributes()); + if (const auto *Call = dyn_cast<CallBase>(&I)) + EnumerateAttributes(Call->getAttributes()); // Enumerate metadata attached with this instruction. MDs.clear(); @@ -752,7 +749,8 @@ void ValueEnumerator::organizeMetadata() { // Rebuild MDs, index the metadata ranges for each function in FunctionMDs, // and fix up MetadataMap. - std::vector<const Metadata *> OldMDs = std::move(MDs); + std::vector<const Metadata *> OldMDs; + MDs.swap(OldMDs); MDs.reserve(OldMDs.size()); for (unsigned I = 0, E = Order.size(); I != E && !Order[I].F; ++I) { auto *MD = Order[I].get(OldMDs); @@ -951,9 +949,11 @@ void ValueEnumerator::incorporateFunction(const Function &F) { incorporateFunctionMetadata(F); // Adding function arguments to the value table. - for (const auto &I : F.args()) + for (const auto &I : F.args()) { EnumerateValue(&I); - + if (I.hasAttribute(Attribute::ByVal)) + EnumerateType(I.getParamByValType()); + } FirstFuncConstantID = Values.size(); // Add all function-level constants to the value table. |