DebugInfo: Add equality operators and default constructor to DILineInfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140223 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2011-09-21 01:13:16 +00:00
parent 73ec95296e
commit ab6acef531

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
#include <cstring>
namespace llvm {
@ -28,12 +29,21 @@ class DILineInfo {
uint32_t Line;
uint32_t Column;
public:
DILineInfo() : FileName("<invalid>"), Line(0), Column(0) {}
DILineInfo(const char *fileName, uint32_t line, uint32_t column)
: FileName(fileName), Line(line), Column(column) {}
const char *getFileName() const { return FileName; }
uint32_t getLine() const { return Line; }
uint32_t getColumn() const { return Column; }
bool operator==(const DILineInfo &RHS) const {
return Line == RHS.Line && Column == RHS.Column &&
std::strcmp(FileName, RHS.FileName) == 0;
}
bool operator!=(const DILineInfo &RHS) const {
return !(*this == RHS);
}
};
class DIContext {