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
This commit is contained in:
Argyrios Kyrtzidis
2009-04-30 23:22:31 +00:00
parent 19fee415f6
commit a26eae64dd
12 changed files with 67 additions and 85 deletions

View File

@@ -19,17 +19,20 @@
#include <vector>
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<DebugLocTuple> {
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<unsigned>::getHashValue(Val.Src) ^
return DenseMapInfo<GlobalVariable*>::getHashValue(Val.CompileUnit) ^
DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
DenseMapInfo<unsigned>::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; }