[llvm] Use llvm::interleaved (NFC) (#145839)
Note that llvm::interleaved constructs a string with the elements from a given range with a given separator.
This commit is contained in:
parent
7eec132f9c
commit
620dbf1fec
@ -12,6 +12,7 @@
|
|||||||
#include "llvm/DebugInfo/GSYM/GsymCreator.h"
|
#include "llvm/DebugInfo/GSYM/GsymCreator.h"
|
||||||
#include "llvm/MC/StringTableBuilder.h"
|
#include "llvm/MC/StringTableBuilder.h"
|
||||||
#include "llvm/Support/DataExtractor.h"
|
#include "llvm/Support/DataExtractor.h"
|
||||||
|
#include "llvm/Support/InterleavedRange.h"
|
||||||
#include "llvm/Support/YAMLParser.h"
|
#include "llvm/Support/YAMLParser.h"
|
||||||
#include "llvm/Support/YAMLTraits.h"
|
#include "llvm/Support/YAMLTraits.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
@ -231,13 +232,7 @@ Error CallSiteInfoLoader::processYAMLFunctions(
|
|||||||
raw_ostream &gsym::operator<<(raw_ostream &OS, const CallSiteInfo &CSI) {
|
raw_ostream &gsym::operator<<(raw_ostream &OS, const CallSiteInfo &CSI) {
|
||||||
OS << " Return=" << HEX64(CSI.ReturnOffset);
|
OS << " Return=" << HEX64(CSI.ReturnOffset);
|
||||||
OS << " Flags=" << HEX8(CSI.Flags);
|
OS << " Flags=" << HEX8(CSI.Flags);
|
||||||
|
OS << " RegEx=" << llvm::interleaved(CSI.MatchRegex, ",");
|
||||||
OS << " RegEx=";
|
|
||||||
for (uint32_t i = 0; i < CSI.MatchRegex.size(); ++i) {
|
|
||||||
if (i > 0)
|
|
||||||
OS << ",";
|
|
||||||
OS << CSI.MatchRegex[i];
|
|
||||||
}
|
|
||||||
return OS;
|
return OS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
#include "llvm/Support/InterleavedRange.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace exegesis {
|
namespace exegesis {
|
||||||
@ -293,15 +294,8 @@ void Instruction::dump(const MCRegisterInfo &RegInfo,
|
|||||||
}
|
}
|
||||||
for (const auto &Var : Variables) {
|
for (const auto &Var : Variables) {
|
||||||
Stream << "- Var" << Var.getIndex();
|
Stream << "- Var" << Var.getIndex();
|
||||||
Stream << " [";
|
Stream << " ";
|
||||||
bool IsFirst = true;
|
Stream << llvm::interleaved_array(Var.TiedOperands, ",");
|
||||||
for (auto OperandIndex : Var.TiedOperands) {
|
|
||||||
if (!IsFirst)
|
|
||||||
Stream << ",";
|
|
||||||
Stream << "Op" << OperandIndex;
|
|
||||||
IsFirst = false;
|
|
||||||
}
|
|
||||||
Stream << "]";
|
|
||||||
Stream << "\n";
|
Stream << "\n";
|
||||||
}
|
}
|
||||||
if (hasMemoryOperands())
|
if (hasMemoryOperands())
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "RemarkCounter.h"
|
#include "RemarkCounter.h"
|
||||||
#include "RemarkUtilRegistry.h"
|
#include "RemarkUtilRegistry.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/InterleavedRange.h"
|
||||||
#include "llvm/Support/Regex.h"
|
#include "llvm/Support/Regex.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -197,23 +198,11 @@ Error ArgumentCounter::print(StringRef OutputFileName) {
|
|||||||
|
|
||||||
auto OF = std::move(*MaybeOF);
|
auto OF = std::move(*MaybeOF);
|
||||||
OF->os() << groupByToStr(Group) << ",";
|
OF->os() << groupByToStr(Group) << ",";
|
||||||
unsigned Idx = 0;
|
OF->os() << llvm::interleaved(llvm::make_first_range(ArgumentSetIdxMap), ",");
|
||||||
for (auto [Key, _] : ArgumentSetIdxMap) {
|
|
||||||
OF->os() << Key;
|
|
||||||
if (Idx != ArgumentSetIdxMap.size() - 1)
|
|
||||||
OF->os() << ",";
|
|
||||||
Idx++;
|
|
||||||
}
|
|
||||||
OF->os() << "\n";
|
OF->os() << "\n";
|
||||||
for (auto [Header, CountVector] : CountByKeysMap) {
|
for (auto [Header, CountVector] : CountByKeysMap) {
|
||||||
OF->os() << Header << ",";
|
OF->os() << Header << ",";
|
||||||
unsigned Idx = 0;
|
OF->os() << llvm::interleaved(CountVector, ",");
|
||||||
for (auto Count : CountVector) {
|
|
||||||
OF->os() << Count;
|
|
||||||
if (Idx != ArgumentSetIdxMap.size() - 1)
|
|
||||||
OF->os() << ",";
|
|
||||||
Idx++;
|
|
||||||
}
|
|
||||||
OF->os() << "\n";
|
OF->os() << "\n";
|
||||||
}
|
}
|
||||||
return Error::success();
|
return Error::success();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user