From a26eae64ddf607549f9e47046d46ea5b9ec648b4 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 30 Apr 2009 23:22:31 +0000 Subject: Make DebugLoc independent of DwarfWriter. -Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable* -Remove DwarfWriter::getOrCreateSourceID -Make necessary changes for the above (fix callsites, etc.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70520 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/DebugLoc.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'include/llvm/CodeGen/DebugLoc.h') diff --git a/include/llvm/CodeGen/DebugLoc.h b/include/llvm/CodeGen/DebugLoc.h index d5ad9dc..77e6733 100644 --- a/include/llvm/CodeGen/DebugLoc.h +++ b/include/llvm/CodeGen/DebugLoc.h @@ -19,17 +19,20 @@ #include namespace llvm { + class GlobalVariable; /// DebugLocTuple - Debug location tuple of filename id, line and column. /// struct DebugLocTuple { - unsigned Src, Line, Col; + GlobalVariable *CompileUnit; + unsigned Line, Col; - DebugLocTuple(unsigned s, unsigned l, unsigned c) - : Src(s), Line(l), Col(c) {}; + DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c) + : CompileUnit(v), Line(l), Col(c) {}; bool operator==(const DebugLocTuple &DLT) const { - return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col; + return CompileUnit == DLT.CompileUnit && + Line == DLT.Line && Col == DLT.Col; } bool operator!=(const DebugLocTuple &DLT) const { return !(*this == DLT); @@ -60,20 +63,20 @@ namespace llvm { // Partially specialize DenseMapInfo for DebugLocTyple. template<> struct DenseMapInfo { static inline DebugLocTuple getEmptyKey() { - return DebugLocTuple(~0U, ~0U, ~0U); + return DebugLocTuple(0, ~0U, ~0U); } static inline DebugLocTuple getTombstoneKey() { - return DebugLocTuple(~1U, ~1U, ~1U); + return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U); } static unsigned getHashValue(const DebugLocTuple &Val) { - return DenseMapInfo::getHashValue(Val.Src) ^ + return DenseMapInfo::getHashValue(Val.CompileUnit) ^ DenseMapInfo::getHashValue(Val.Line) ^ DenseMapInfo::getHashValue(Val.Col); } static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) { - return LHS.Src == RHS.Src && - LHS.Line == RHS.Line && - LHS.Col == RHS.Col; + return LHS.CompileUnit == RHS.CompileUnit && + LHS.Line == RHS.Line && + LHS.Col == RHS.Col; } static bool isPod() { return true; } -- cgit v1.1