forked from OSchip/llvm-project
AsmWriter: Only collect attachment names once per module
Collect metadata names once per `AssemblyWriter` instead of every time we need to print some attachments. Just a drive-by; this caught my eye while I was refactoring the code in r235772. llvm-svn: 235774
This commit is contained in:
parent
5e5524bc25
commit
e30f10e671
|
@ -1943,6 +1943,7 @@ class AssemblyWriter {
|
||||||
SetVector<const Comdat *> Comdats;
|
SetVector<const Comdat *> Comdats;
|
||||||
bool ShouldPreserveUseListOrder;
|
bool ShouldPreserveUseListOrder;
|
||||||
UseListOrderStack UseListOrders;
|
UseListOrderStack UseListOrders;
|
||||||
|
SmallVector<StringRef, 8> MDNames;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Construct an AssemblyWriter with an external SlotTracker
|
/// Construct an AssemblyWriter with an external SlotTracker
|
||||||
|
@ -2967,8 +2968,9 @@ void AssemblyWriter::printMetadataAttachments(
|
||||||
if (MDs.empty())
|
if (MDs.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SmallVector<StringRef, 8> MDNames;
|
if (MDNames.empty())
|
||||||
TheModule->getMDKindNames(MDNames);
|
TheModule->getMDKindNames(MDNames);
|
||||||
|
|
||||||
for (const auto &I : MDs) {
|
for (const auto &I : MDs) {
|
||||||
unsigned Kind = I.first;
|
unsigned Kind = I.first;
|
||||||
if (Kind < MDNames.size()) {
|
if (Kind < MDNames.size()) {
|
||||||
|
|
Loading…
Reference in New Issue