summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h38
-rw-r--r--llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h24
-rw-r--r--llvm/include/llvm/ProfileData/InstrProf.h70
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfData.inc7
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfReader.h86
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfWriter.h12
-rw-r--r--llvm/include/llvm/ProfileData/ProfileCommon.h24
7 files changed, 101 insertions, 160 deletions
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index 08d1cdf3b2e..56be7ac0f5d 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -23,13 +23,13 @@
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
#include <tuple>
namespace llvm {
namespace coverage {
-
enum class coveragemap_error {
success = 0,
eof,
@@ -38,20 +38,14 @@ enum class coveragemap_error {
truncated,
malformed
};
-
-class CoverageMapError : public ProfErrorInfoBase<coveragemap_error> {
-public:
- CoverageMapError(coveragemap_error Err)
- : ProfErrorInfoBase<coveragemap_error>(Err) {}
-
- std::string message() const override;
-};
-
} // end of coverage namespace.
+}
-template <> char ProfErrorInfoBase<coverage::coveragemap_error>::ID;
-
-} // end of llvm namespace
+namespace std {
+template <>
+struct is_error_code_enum<llvm::coverage::coveragemap_error> : std::true_type {
+};
+}
namespace llvm {
class IndexedInstrProfReader;
@@ -271,7 +265,7 @@ public:
/// \brief Return the number of times that a region of code associated with
/// this counter was executed.
- Expected<int64_t> evaluate(const Counter &C) const;
+ ErrorOr<int64_t> evaluate(const Counter &C) const;
};
/// \brief Code coverage information for a single function.
@@ -421,12 +415,12 @@ class CoverageMapping {
public:
/// \brief Load the coverage mapping using the given readers.
- static Expected<std::unique_ptr<CoverageMapping>>
+ static ErrorOr<std::unique_ptr<CoverageMapping>>
load(CoverageMappingReader &CoverageReader,
IndexedInstrProfReader &ProfileReader);
/// \brief Load the coverage mapping from the given files.
- static Expected<std::unique_ptr<CoverageMapping>>
+ static ErrorOr<std::unique_ptr<CoverageMapping>>
load(StringRef ObjectFilename, StringRef ProfileFilename,
StringRef Arch = StringRef());
@@ -507,13 +501,14 @@ template <class IntPtrT> struct CovMapFunctionRecordV1 {
}
// Return the PGO name of the function */
template <support::endianness Endian>
- Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
+ std::error_code getFuncName(InstrProfSymtab &ProfileNames,
+ StringRef &FuncName) const {
IntPtrT NameRef = getFuncNameRef<Endian>();
uint32_t NameS = support::endian::byte_swap<uint32_t, Endian>(NameSize);
FuncName = ProfileNames.getFuncName(NameRef, NameS);
if (NameS && FuncName.empty())
- return make_error<CoverageMapError>(coveragemap_error::malformed);
- return Error::success();
+ return coveragemap_error::malformed;
+ return std::error_code();
}
};
@@ -535,10 +530,11 @@ struct CovMapFunctionRecord {
}
// Return the PGO name of the function */
template <support::endianness Endian>
- Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
+ std::error_code getFuncName(InstrProfSymtab &ProfileNames,
+ StringRef &FuncName) const {
uint64_t NameRef = getFuncNameRef<Endian>();
FuncName = ProfileNames.getFuncName(NameRef);
- return Error::success();
+ return std::error_code();
}
};
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
index ce743a96d1d..709006fb113 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
@@ -69,7 +69,7 @@ public:
class CoverageMappingReader {
public:
- virtual Error readNextRecord(CoverageMappingRecord &Record) = 0;
+ virtual std::error_code readNextRecord(CoverageMappingRecord &Record) = 0;
CoverageMappingIterator begin() { return CoverageMappingIterator(this); }
CoverageMappingIterator end() { return CoverageMappingIterator(); }
virtual ~CoverageMappingReader() {}
@@ -82,10 +82,10 @@ protected:
RawCoverageReader(StringRef Data) : Data(Data) {}
- Error readULEB128(uint64_t &Result);
- Error readIntMax(uint64_t &Result, uint64_t MaxPlus1);
- Error readSize(uint64_t &Result);
- Error readString(StringRef &Result);
+ std::error_code readULEB128(uint64_t &Result);
+ std::error_code readIntMax(uint64_t &Result, uint64_t MaxPlus1);
+ std::error_code readSize(uint64_t &Result);
+ std::error_code readString(StringRef &Result);
};
/// \brief Reader for the raw coverage filenames.
@@ -100,7 +100,7 @@ public:
RawCoverageFilenamesReader(StringRef Data, std::vector<StringRef> &Filenames)
: RawCoverageReader(Data), Filenames(Filenames) {}
- Error read();
+ std::error_code read();
};
/// \brief Reader for the raw coverage mapping data.
@@ -125,12 +125,12 @@ public:
Filenames(Filenames), Expressions(Expressions),
MappingRegions(MappingRegions) {}
- Error read();
+ std::error_code read();
private:
- Error decodeCounter(unsigned Value, Counter &C);
- Error readCounter(Counter &C);
- Error
+ std::error_code decodeCounter(unsigned Value, Counter &C);
+ std::error_code readCounter(Counter &C);
+ std::error_code
readMappingRegionsSubArray(std::vector<CounterMappingRegion> &MappingRegions,
unsigned InferredFileID, size_t NumFileIDs);
};
@@ -170,11 +170,11 @@ private:
BinaryCoverageReader() : CurrentRecord(0) {}
public:
- static Expected<std::unique_ptr<BinaryCoverageReader>>
+ static ErrorOr<std::unique_ptr<BinaryCoverageReader>>
create(std::unique_ptr<MemoryBuffer> &ObjectBuffer,
StringRef Arch);
- Error readNextRecord(CoverageMappingRecord &Record) override;
+ std::error_code readNextRecord(CoverageMappingRecord &Record) override;
};
} // end namespace coverage
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 86fab33613b..1f46650c528 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -25,6 +25,7 @@
#include "llvm/ProfileData/ProfileCommon.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include <cstdint>
@@ -203,17 +204,20 @@ StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName,
/// third field is the uncompressed strings; otherwise it is the
/// compressed string. When the string compression is off, the
/// second field will have value zero.
-Error collectPGOFuncNameStrings(const std::vector<std::string> &NameStrs,
- bool doCompression, std::string &Result);
+std::error_code
+collectPGOFuncNameStrings(const std::vector<std::string> &NameStrs,
+ bool doCompression, std::string &Result);
/// Produce \c Result string with the same format described above. The input
/// is vector of PGO function name variables that are referenced.
-Error collectPGOFuncNameStrings(const std::vector<GlobalVariable *> &NameVars,
- std::string &Result, bool doCompression = true);
+std::error_code
+collectPGOFuncNameStrings(const std::vector<GlobalVariable *> &NameVars,
+ std::string &Result, bool doCompression = true);
class InstrProfSymtab;
/// \c NameStrings is a string composed of one of more sub-strings encoded in
/// the format described above. The substrings are seperated by 0 or more zero
/// bytes. This method decodes the string and populates the \c Symtab.
-Error readPGOFuncNameStrings(StringRef NameStrings, InstrProfSymtab &Symtab);
+std::error_code readPGOFuncNameStrings(StringRef NameStrings,
+ InstrProfSymtab &Symtab);
enum InstrProfValueKind : uint32_t {
#define VALUE_PROF_KIND(Enumerator, Value) Enumerator = Value,
@@ -280,27 +284,6 @@ inline std::error_code make_error_code(instrprof_error E) {
return std::error_code(static_cast<int>(E), instrprof_category());
}
-class InstrProfError : public ProfErrorInfoBase<instrprof_error> {
-public:
- InstrProfError(instrprof_error Err)
- : ProfErrorInfoBase<instrprof_error>(Err) {}
-
- std::string message() const override;
-
- /// Consume an Error and return the raw enum value contained within it. The
- /// Error must either be a success value, or contain a single InstrProfError.
- static instrprof_error take(Error E) {
- auto Err = instrprof_error::success;
- handleAllErrors(std::move(E), [&Err](const InstrProfError &IPE) {
- assert(Err == instrprof_error::success && "Multiple errors encountered");
- Err = IPE.get();
- });
- return Err;
- }
-};
-
-template <> char ProfErrorInfoBase<instrprof_error>::ID;
-
class SoftInstrProfErrors {
/// Count the number of soft instrprof_errors encountered and keep track of
/// the first such error for reporting purposes.
@@ -326,11 +309,6 @@ public:
NumCountMismatches(0), NumCounterOverflows(0),
NumValueSiteCountMismatches(0) {}
- ~SoftInstrProfErrors() {
- assert(FirstError == instrprof_error::success &&
- "Unchecked soft error encountered");
- }
-
/// Track a soft error (\p IE) and increment its associated counter.
void addError(instrprof_error IE);
@@ -348,15 +326,8 @@ public:
return NumValueSiteCountMismatches;
}
- /// Return the first encountered error and reset FirstError to a success
- /// value.
- Error takeError() {
- if (FirstError == instrprof_error::success)
- return Error::success();
- auto E = make_error<InstrProfError>(FirstError);
- FirstError = instrprof_error::success;
- return E;
- }
+ /// Return an error code for the first encountered error.
+ std::error_code getError() const { return make_error_code(FirstError); }
};
namespace object {
@@ -401,14 +372,14 @@ public:
/// only initialize the symtab with reference to the data and
/// the section base address. The decompression will be delayed
/// until before it is used. See also \c create(StringRef) method.
- Error create(object::SectionRef &Section);
+ std::error_code create(object::SectionRef &Section);
/// This interface is used by reader of CoverageMapping test
/// format.
- inline Error create(StringRef D, uint64_t BaseAddr);
+ inline std::error_code create(StringRef D, uint64_t BaseAddr);
/// \c NameStrings is a string composed of one of more sub-strings
/// encoded in the format described in \c collectPGOFuncNameStrings.
/// This method is a wrapper to \c readPGOFuncNameStrings method.
- inline Error create(StringRef NameStrings);
+ inline std::error_code create(StringRef NameStrings);
/// A wrapper interface to populate the PGO symtab with functions
/// decls from module \c M. This interface is used by transformation
/// passes such as indirect function call promotion. Variable \c InLTO
@@ -453,13 +424,13 @@ public:
inline StringRef getNameData() const { return Data; }
};
-Error InstrProfSymtab::create(StringRef D, uint64_t BaseAddr) {
+std::error_code InstrProfSymtab::create(StringRef D, uint64_t BaseAddr) {
Data = D;
Address = BaseAddr;
- return Error::success();
+ return std::error_code();
}
-Error InstrProfSymtab::create(StringRef NameStrings) {
+std::error_code InstrProfSymtab::create(StringRef NameStrings) {
return readPGOFuncNameStrings(NameStrings, *this);
}
@@ -601,7 +572,7 @@ struct InstrProfRecord {
}
/// Get the error contained within the record's soft error counter.
- Error takeError() { return SIPE.takeError(); }
+ std::error_code getError() const { return SIPE.getError(); }
private:
std::vector<InstrProfValueSiteRecord> IndirectCallSites;
@@ -898,4 +869,9 @@ struct Header {
} // end namespace llvm
+namespace std {
+template <>
+struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
+}
+
#endif // LLVM_PROFILEDATA_INSTRPROF_H
diff --git a/llvm/include/llvm/ProfileData/InstrProfData.inc b/llvm/include/llvm/ProfileData/InstrProfData.inc
index a9f3c50bf97..49c3266c269 100644
--- a/llvm/include/llvm/ProfileData/InstrProfData.inc
+++ b/llvm/include/llvm/ProfileData/InstrProfData.inc
@@ -322,15 +322,16 @@ typedef struct ValueProfData {
static std::unique_ptr<ValueProfData>
serializeFrom(const InstrProfRecord &Record);
/*!
- * Check the integrity of the record.
+ * Check the integrity of the record. Return the error code when
+ * an error is detected, otherwise return instrprof_error::success.
*/
- Error checkIntegrity();
+ instrprof_error checkIntegrity();
/*!
* Return a pointer to \c ValueProfileData instance ready to be read.
* All data in the instance are properly byte swapped. The input
* data is assumed to be in little endian order.
*/
- static Expected<std::unique_ptr<ValueProfData>>
+ static ErrorOr<std::unique_ptr<ValueProfData>>
getValueProfData(const unsigned char *SrcBuffer,
const unsigned char *const SrcBufferEnd,
support::endianness SrcDataEndianness);
diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index 4e9e618324a..a5d06264536 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/EndianStream.h"
+#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
@@ -50,16 +51,16 @@ public:
/// Base class and interface for reading profiling data of any known instrprof
/// format. Provides an iterator over InstrProfRecords.
class InstrProfReader {
- instrprof_error LastError;
+ std::error_code LastError;
public:
InstrProfReader() : LastError(instrprof_error::success), Symtab() {}
virtual ~InstrProfReader() {}
/// Read the header. Required before reading first record.
- virtual Error readHeader() = 0;
+ virtual std::error_code readHeader() = 0;
/// Read a single record.
- virtual Error readNextRecord(InstrProfRecord &Record) = 0;
+ virtual std::error_code readNextRecord(InstrProfRecord &Record) = 0;
/// Iterator over profile data.
InstrProfIterator begin() { return InstrProfIterator(this); }
InstrProfIterator end() { return InstrProfIterator(); }
@@ -79,35 +80,28 @@ public:
protected:
std::unique_ptr<InstrProfSymtab> Symtab;
- /// Set the current error and return same.
- Error error(instrprof_error Err) {
- LastError = Err;
- if (Err == instrprof_error::success)
- return Error::success();
- return make_error<InstrProfError>(Err);
+ /// Set the current std::error_code and return same.
+ std::error_code error(std::error_code EC) {
+ LastError = EC;
+ return EC;
}
- Error error(Error E) { return error(InstrProfError::take(std::move(E))); }
- /// Clear the current error and return a successful one.
- Error success() { return error(instrprof_error::success); }
+ /// Clear the current error code and return a successful one.
+ std::error_code success() { return error(instrprof_error::success); }
public:
/// Return true if the reader has finished reading the profile data.
bool isEOF() { return LastError == instrprof_error::eof; }
/// Return true if the reader encountered an error reading profiling data.
- bool hasError() { return LastError != instrprof_error::success && !isEOF(); }
- /// Get the current error.
- Error getError() {
- if (hasError())
- return make_error<InstrProfError>(LastError);
- return Error::success();
- }
+ bool hasError() { return LastError && !isEOF(); }
+ /// Get the current error code.
+ std::error_code getError() { return LastError; }
/// Factory method to create an appropriately typed reader for the given
/// instrprof file.
- static Expected<std::unique_ptr<InstrProfReader>> create(std::string Path);
+ static ErrorOr<std::unique_ptr<InstrProfReader>> create(std::string Path);
- static Expected<std::unique_ptr<InstrProfReader>>
+ static ErrorOr<std::unique_ptr<InstrProfReader>>
create(std::unique_ptr<MemoryBuffer> Buffer);
};
@@ -129,7 +123,7 @@ private:
TextInstrProfReader(const TextInstrProfReader &) = delete;
TextInstrProfReader &operator=(const TextInstrProfReader &) = delete;
- Error readValueProfileData(InstrProfRecord &Record);
+ std::error_code readValueProfileData(InstrProfRecord &Record);
public:
TextInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer_)
@@ -142,9 +136,9 @@ public:
bool isIRLevelProfile() const override { return IsIRLevelProfile; }
/// Read the header.
- Error readHeader() override;
+ std::error_code readHeader() override;
/// Read a single record.
- Error readNextRecord(InstrProfRecord &Record) override;
+ std::error_code readNextRecord(InstrProfRecord &Record) override;
InstrProfSymtab &getSymtab() override {
assert(Symtab.get());
@@ -191,8 +185,8 @@ public:
: DataBuffer(std::move(DataBuffer)) { }
static bool hasFormat(const MemoryBuffer &DataBuffer);
- Error readHeader() override;
- Error readNextRecord(InstrProfRecord &Record) override;
+ std::error_code readHeader() override;
+ std::error_code readNextRecord(InstrProfRecord &Record) override;
bool isIRLevelProfile() const override {
return (Version & VARIANT_MASK_IR_PROF) != 0;
}
@@ -203,9 +197,9 @@ public:
}
private:
- Error createSymtab(InstrProfSymtab &Symtab);
- Error readNextHeader(const char *CurrentPos);
- Error readHeader(const RawInstrProf::Header &Header);
+ std::error_code createSymtab(InstrProfSymtab &Symtab);
+ std::error_code readNextHeader(const char *CurrentPos);
+ std::error_code readHeader(const RawInstrProf::Header &Header);
template <class IntT> IntT swap(IntT Int) const {
return ShouldSwapBytes ? sys::getSwappedBytes(Int) : Int;
}
@@ -222,10 +216,10 @@ private:
inline uint8_t getNumPaddingBytes(uint64_t SizeInBytes) {
return 7 & (sizeof(uint64_t) - SizeInBytes % sizeof(uint64_t));
}
- Error readName(InstrProfRecord &Record);
- Error readFuncHash(InstrProfRecord &Record);
- Error readRawCounts(InstrProfRecord &Record);
- Error readValueProfilingData(InstrProfRecord &Record);
+ std::error_code readName(InstrProfRecord &Record);
+ std::error_code readFuncHash(InstrProfRecord &Record);
+ std::error_code readRawCounts(InstrProfRecord &Record);
+ std::error_code readValueProfilingData(InstrProfRecord &Record);
bool atEnd() const { return Data == DataEnd; }
void advanceData() {
Data++;
@@ -306,9 +300,9 @@ public:
struct InstrProfReaderIndexBase {
// Read all the profile records with the same key pointed to the current
// iterator.
- virtual Error getRecords(ArrayRef<InstrProfRecord> &Data) = 0;
+ virtual std::error_code getRecords(ArrayRef<InstrProfRecord> &Data) = 0;
// Read all the profile records with the key equal to FuncName
- virtual Error getRecords(StringRef FuncName,
+ virtual std::error_code getRecords(StringRef FuncName,
ArrayRef<InstrProfRecord> &Data) = 0;
virtual void advanceToNextKey() = 0;
virtual bool atEnd() const = 0;
@@ -336,9 +330,9 @@ public:
const unsigned char *const Base,
IndexedInstrProf::HashT HashType, uint64_t Version);
- Error getRecords(ArrayRef<InstrProfRecord> &Data) override;
- Error getRecords(StringRef FuncName,
- ArrayRef<InstrProfRecord> &Data) override;
+ std::error_code getRecords(ArrayRef<InstrProfRecord> &Data) override;
+ std::error_code getRecords(StringRef FuncName,
+ ArrayRef<InstrProfRecord> &Data) override;
void advanceToNextKey() override { RecordIterator++; }
bool atEnd() const override {
return RecordIterator == HashTable->data_end();
@@ -385,27 +379,27 @@ public:
static bool hasFormat(const MemoryBuffer &DataBuffer);
/// Read the file header.
- Error readHeader() override;
+ std::error_code readHeader() override;
/// Read a single record.
- Error readNextRecord(InstrProfRecord &Record) override;
+ std::error_code readNextRecord(InstrProfRecord &Record) override;
/// Return the pointer to InstrProfRecord associated with FuncName
/// and FuncHash
- Expected<InstrProfRecord> getInstrProfRecord(StringRef FuncName,
- uint64_t FuncHash);
+ ErrorOr<InstrProfRecord> getInstrProfRecord(StringRef FuncName,
+ uint64_t FuncHash);
/// Fill Counts with the profile data for the given function name.
- Error getFunctionCounts(StringRef FuncName, uint64_t FuncHash,
- std::vector<uint64_t> &Counts);
+ std::error_code getFunctionCounts(StringRef FuncName, uint64_t FuncHash,
+ std::vector<uint64_t> &Counts);
/// Return the maximum of all known function counts.
uint64_t getMaximumFunctionCount() { return Summary->getMaxFunctionCount(); }
/// Factory method to create an indexed reader.
- static Expected<std::unique_ptr<IndexedInstrProfReader>>
+ static ErrorOr<std::unique_ptr<IndexedInstrProfReader>>
create(std::string Path);
- static Expected<std::unique_ptr<IndexedInstrProfReader>>
+ static ErrorOr<std::unique_ptr<IndexedInstrProfReader>>
create(std::unique_ptr<MemoryBuffer> Buffer);
// Used for testing purpose only.
diff --git a/llvm/include/llvm/ProfileData/InstrProfWriter.h b/llvm/include/llvm/ProfileData/InstrProfWriter.h
index 7d292731ccc..8b02d3cc9ed 100644
--- a/llvm/include/llvm/ProfileData/InstrProfWriter.h
+++ b/llvm/include/llvm/ProfileData/InstrProfWriter.h
@@ -46,7 +46,7 @@ public:
/// Add function counts for the given function. If there are already counts
/// for this function and the hash and number of counts match, each counter is
/// summed. Optionally scale counts by \p Weight.
- Error addRecord(InstrProfRecord &&I, uint64_t Weight = 1);
+ std::error_code addRecord(InstrProfRecord &&I, uint64_t Weight = 1);
/// Write the profile to \c OS
void write(raw_fd_ostream &OS);
/// Write the profile in text format to \c OS
@@ -58,15 +58,13 @@ public:
std::unique_ptr<MemoryBuffer> writeBuffer();
/// Set the ProfileKind. Report error if mixing FE and IR level profiles.
- Error setIsIRLevelProfile(bool IsIRLevel) {
+ std::error_code setIsIRLevelProfile(bool IsIRLevel) {
if (ProfileKind == PF_Unknown) {
ProfileKind = IsIRLevel ? PF_IRLevel: PF_FE;
- return Error::success();
+ return instrprof_error::success;
}
- return (IsIRLevel == (ProfileKind == PF_IRLevel))
- ? Error::success()
- : make_error<InstrProfError>(
- instrprof_error::unsupported_version);
+ return (IsIRLevel == (ProfileKind == PF_IRLevel)) ?
+ instrprof_error::success : instrprof_error::unsupported_version;
}
// Internal interface for testing purpose only.
diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h
index c367b5951c4..ae196aa5d00 100644
--- a/llvm/include/llvm/ProfileData/ProfileCommon.h
+++ b/llvm/include/llvm/ProfileData/ProfileCommon.h
@@ -21,7 +21,6 @@
#include <vector>
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Error.h"
namespace llvm {
class Function;
@@ -37,29 +36,6 @@ class Metadata;
class MDTuple;
class MDNode;
-template <typename ErrT>
-class ProfErrorInfoBase : public ErrorInfo<ProfErrorInfoBase<ErrT>> {
-public:
- ProfErrorInfoBase(ErrT Err) : Err(Err) {
- assert(Err != ErrT::success && "Not an error");
- }
-
- virtual std::string message() const override = 0;
-
- void log(raw_ostream &OS) const override { OS << message(); }
-
- std::error_code convertToErrorCode() const override {
- return make_error_code(Err);
- }
-
- ErrT get() const { return Err; }
-
- static char ID;
-
-protected:
- ErrT Err;
-};
-
inline const char *getHotSectionPrefix() { return ".hot"; }
inline const char *getUnlikelySectionPrefix() { return ".unlikely"; }
OpenPOWER on IntegriCloud