39 void DIPrinter::printContext(
const std::string &FileName, int64_t Line) {
40 if (PrintSourceContext <= 0)
48 std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.
get());
50 std::max(static_cast<int64_t>(1), Line - PrintSourceContext / 2);
51 int64_t LastLine = FirstLine + PrintSourceContext;
52 size_t MaxLineNumberWidth = std::ceil(std::log10(LastLine));
55 !
I.is_at_eof() &&
I.line_number() <= LastLine; ++
I) {
56 int64_t
L =
I.line_number();
57 if (L >= FirstLine && L <= LastLine) {
68 void DIPrinter::print(
const DILineInfo &Info,
bool Inlined) {
69 if (PrintFunctionNames) {
74 StringRef Delimiter = PrintPretty ?
" at " :
"\n";
76 OS << Prefix << FunctionName << Delimiter;
78 std::string Filename = Info.
FileName;
81 OS << Filename <<
":" << Info.
Line <<
":" << Info.
Column <<
"\n";
82 printContext(Filename, Info.
Line);
106 OS << Global.
Start <<
" " << Global.
Size <<
"\n";
Represents either an error or a value T.
A forward iterator which reads text lines from a buffer.
DIPrinter & operator<<(const DILineInfo &Info)
DILineInfo - a format-neutral container for source line information.
uint32_t getNumberOfFrames() const
DILineInfo getFrame(unsigned Index) const
DIInliningInfo - a format-neutral container for inlined code description.
static const char kBadString[]
FormattedNumber format_decimal(int64_t N, unsigned Width)
format_decimal - Output N as a right justified, fixed-width decimal.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatileSize=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
static const char kDILineInfoBadString[]
Provides ErrorOr<T> smart pointer.
StringRef - Represent a constant reference to a string, i.e.
DIGlobal - container for description of a global variable.