summaryrefslogtreecommitdiff
path: root/lib/ProfileData/InstrProfWriter.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
commit08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch)
tree80108f0f128657f8623f8f66ad9735b4d88e7b47 /lib/ProfileData/InstrProfWriter.cpp
parent7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff)
Notes
Diffstat (limited to 'lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r--lib/ProfileData/InstrProfWriter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/ProfileData/InstrProfWriter.cpp b/lib/ProfileData/InstrProfWriter.cpp
index b3402a6ea956c..9efea78ed2a89 100644
--- a/lib/ProfileData/InstrProfWriter.cpp
+++ b/lib/ProfileData/InstrProfWriter.cpp
@@ -69,8 +69,7 @@ public:
write(P[K].D[I]);
}
} else {
- raw_string_ostream &SOStream =
- static_cast<llvm::raw_string_ostream &>(OS);
+ raw_string_ostream &SOStream = static_cast<raw_string_ostream &>(OS);
std::string &Data = SOStream.str(); // with flush
for (int K = 0; K < NItems; K++) {
for (int I = 0; I < P[K].N; I++) {
@@ -91,14 +90,14 @@ public:
class InstrProfRecordWriterTrait {
public:
- typedef StringRef key_type;
- typedef StringRef key_type_ref;
+ using key_type = StringRef;
+ using key_type_ref = StringRef;
- typedef const InstrProfWriter::ProfilingData *const data_type;
- typedef const InstrProfWriter::ProfilingData *const data_type_ref;
+ using data_type = const InstrProfWriter::ProfilingData *const;
+ using data_type_ref = const InstrProfWriter::ProfilingData *const;
- typedef uint64_t hash_value_type;
- typedef uint64_t offset_type;
+ using hash_value_type = uint64_t;
+ using offset_type = uint64_t;
support::endianness ValueProfDataEndianness = support::little;
InstrProfSummaryBuilder *SummaryBuilder;
@@ -363,17 +362,19 @@ void InstrProfWriter::writeRecordInText(const InstrProfRecord &Func,
OS << "\n";
}
-void InstrProfWriter::writeText(raw_fd_ostream &OS) {
+Error InstrProfWriter::writeText(raw_fd_ostream &OS) {
if (ProfileKind == PF_IRLevel)
OS << "# IR level Instrumentation Flag\n:ir\n";
InstrProfSymtab Symtab;
for (const auto &I : FunctionData)
if (shouldEncodeData(I.getValue()))
- Symtab.addFuncName(I.getKey());
+ if (Error E = Symtab.addFuncName(I.getKey()))
+ return E;
Symtab.finalizeSymtab();
for (const auto &I : FunctionData)
if (shouldEncodeData(I.getValue()))
for (const auto &Func : I.getValue())
writeRecordInText(Func.second, Symtab, OS);
+ return Error::success();
}