LLVM  3.7.0
SampleProf.cpp
Go to the documentation of this file.
1 //=-- SampleProf.cpp - Sample profiling format support --------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains common definitions used in the reading and writing of
11 // sample profile data.
12 //
13 //===----------------------------------------------------------------------===//
14 
18 
19 using namespace llvm;
20 
21 namespace {
22 class SampleProfErrorCategoryType : public std::error_category {
23  const char *name() const LLVM_NOEXCEPT override { return "llvm.sampleprof"; }
24  std::string message(int IE) const override {
25  sampleprof_error E = static_cast<sampleprof_error>(IE);
26  switch (E) {
28  return "Success";
30  return "Invalid file format (bad magic)";
32  return "Unsupported format version";
34  return "Too much profile data";
36  return "Truncated profile data";
38  return "Malformed profile data";
40  return "Unrecognized profile encoding format";
41  }
42  llvm_unreachable("A value of sampleprof_error has no message.");
43  }
44 };
45 }
46 
48 
50  return *ErrorCategory;
51 }
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
#define LLVM_NOEXCEPT
Definition: Compiler.h:70
sampleprof_error
Definition: SampleProf.h:28
static ManagedStatic< _object_error_category > error_category
const std::error_category & sampleprof_category()
Definition: SampleProf.cpp:49
static ManagedStatic< SampleProfErrorCategoryType > ErrorCategory
Definition: SampleProf.cpp:47
aarch64 promote const
static const char * name
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:61