diff options
Diffstat (limited to 'llvm/include/llvm/DebugInfo/DIContext.h')
| -rw-r--r-- | llvm/include/llvm/DebugInfo/DIContext.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h index ce0a156e9f7..d1336610f32 100644 --- a/llvm/include/llvm/DebugInfo/DIContext.h +++ b/llvm/include/llvm/DebugInfo/DIContext.h @@ -17,6 +17,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/raw_ostream.h" #include <cassert> #include <cstdint> #include <memory> @@ -26,8 +27,6 @@ namespace llvm { -class raw_ostream; - /// A format-neutral container for source line information. struct DILineInfo { std::string FileName; @@ -46,15 +45,30 @@ struct DILineInfo { FileName == RHS.FileName && FunctionName == RHS.FunctionName && StartLine == RHS.StartLine && Discriminator == RHS.Discriminator; } + bool operator!=(const DILineInfo &RHS) const { return !(*this == RHS); } + bool operator<(const DILineInfo &RHS) const { return std::tie(FileName, FunctionName, Line, Column, StartLine, Discriminator) < std::tie(RHS.FileName, RHS.FunctionName, RHS.Line, RHS.Column, RHS.StartLine, RHS.Discriminator); } + + operator bool() const { return (*this) != DILineInfo(); } + + void dump(raw_ostream &OS) { + OS << "Line info: "; + if (FileName != "<invalid>") + OS << "file '" << FileName << "', "; + if (FunctionName != "<invalid>") + OS << "function '" << FunctionName << "', "; + OS << "line " << Line << ", "; + OS << "column " << Column << ", "; + OS << "start line " << StartLine << '\n'; + } }; using DILineInfoTable = SmallVector<std::pair<uint64_t, DILineInfo>, 16>; |

