diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 20:23:46 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 23:25:25 +0100 |
commit | adcd02683856c30ba6f349279509acecd90063df (patch) | |
tree | 7b5927ef2ecab1618842183fac5ebe848f5832dd /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff) | |
download | llvm-adcd02683856c30ba6f349279509acecd90063df.zip llvm-adcd02683856c30ba6f349279509acecd90063df.tar.gz llvm-adcd02683856c30ba6f349279509acecd90063df.tar.bz2 |
Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.
This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.
This doesn't actually modify StringRef yet, I'll do that in a follow-up.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 3f45dfe..540a623 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1174,7 +1174,7 @@ void ModuleBitcodeWriter::writeModuleInfo() { MaxGlobalType = std::max(MaxGlobalType, VE.getTypeID(GV.getValueType())); if (GV.hasSection()) { // Give section names unique ID's. - unsigned &Entry = SectionMap[GV.getSection()]; + unsigned &Entry = SectionMap[std::string(GV.getSection())]; if (!Entry) { writeStringRecord(Stream, bitc::MODULE_CODE_SECTIONNAME, GV.getSection(), 0 /*TODO*/); @@ -1186,7 +1186,7 @@ void ModuleBitcodeWriter::writeModuleInfo() { MaxAlignment = std::max(MaxAlignment, F.getAlignment()); if (F.hasSection()) { // Give section names unique ID's. - unsigned &Entry = SectionMap[F.getSection()]; + unsigned &Entry = SectionMap[std::string(F.getSection())]; if (!Entry) { writeStringRecord(Stream, bitc::MODULE_CODE_SECTIONNAME, F.getSection(), 0 /*TODO*/); @@ -1276,7 +1276,8 @@ void ModuleBitcodeWriter::writeModuleInfo() { (VE.getValueID(GV.getInitializer()) + 1)); Vals.push_back(getEncodedLinkage(GV)); Vals.push_back(Log2_32(GV.getAlignment())+1); - Vals.push_back(GV.hasSection() ? SectionMap[GV.getSection()] : 0); + Vals.push_back(GV.hasSection() ? SectionMap[std::string(GV.getSection())] + : 0); if (GV.isThreadLocal() || GV.getVisibility() != GlobalValue::DefaultVisibility || GV.getUnnamedAddr() != GlobalValue::UnnamedAddr::None || @@ -1321,7 +1322,8 @@ void ModuleBitcodeWriter::writeModuleInfo() { Vals.push_back(getEncodedLinkage(F)); Vals.push_back(VE.getAttributeListID(F.getAttributes())); Vals.push_back(Log2_32(F.getAlignment())+1); - Vals.push_back(F.hasSection() ? SectionMap[F.getSection()] : 0); + Vals.push_back(F.hasSection() ? SectionMap[std::string(F.getSection())] + : 0); Vals.push_back(getEncodedVisibility(F)); Vals.push_back(F.hasGC() ? GCMap[F.getGC()] : 0); Vals.push_back(getEncodedUnnamedAddr(F)); |