Refine DebugLoc per review comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2009-01-27 21:15:07 +00:00
parent ce9bc12c6f
commit aaeea9e64f
3 changed files with 22 additions and 19 deletions

View File

@@ -33,16 +33,21 @@ namespace llvm {
unsigned Idx;
public:
DebugLoc() : Idx(~0U) {}
DebugLoc() : Idx(~0U) {} // Defaults to invalid.
static DebugLoc getNoDebugLoc() { DebugLoc L; L.Idx = 0; return L; }
static DebugLoc getUnknownLoc() { DebugLoc L; L.Idx = 0; return L; }
static DebugLoc get(unsigned idx) { DebugLoc L; L.Idx = idx; return L; }
bool isInvalid() { return Idx == ~0U; }
bool isUnknown() { return Idx == 0; }
// isInvalid - Return true if the DebugLoc is invalid.
bool isInvalid() const { return Idx == ~0U; }
// isUnknown - Return true if there is no debug info for the SDNode /
// MachineInstr.
bool isUnknown() const { return Idx == 0; }
};
struct DebugLocTupleDenseMapInfo {
// Partially specialize DenseMapInfo for DebugLocTyple.
template<> struct DenseMapInfo<DebugLocTuple> {
static inline DebugLocTuple getEmptyKey() {
return DebugLocTuple(~0U, ~0U, ~0U);
}
@@ -63,9 +68,6 @@ namespace llvm {
static bool isPod() { return true; }
};
typedef DenseMap<DebugLocTuple, unsigned, DebugLocTupleDenseMapInfo>
DebugIdMapType;
/// DebugLocTracker - This class tracks debug location information.
///
struct DebugLocTracker {
@@ -75,7 +77,7 @@ namespace llvm {
// DebugIdsMap - This maps DebugLocTuple's to indices into
// DebugLocations vector.
DebugIdMapType DebugIdMap;
DenseMap<DebugLocTuple, unsigned> DebugIdMap;
DebugLocTracker() {}