Skip to content

Commit 1ceb0d2

Browse files
committed
DebugInfo: Remove dead code from old DebugLoc API
Remove old API for `DebugLoc` now that all the callers have been updated. If this broke your out-of-tree build, here's a quick map from the old API to the new one: DebugLoc DebugLoc::getFromMDLocation(MDNode *) => DebugLoc::DebugLoc(MDLocation *) => explicit DebugLoc::DebugLoc(MDNode *) // works with broken code MDNode *DebugLoc::getAsMDNode(LLVMContext &) => MDLocation *DebugLoc::get() => DebugLoc::operator MDLocation *() => MDNode *DebugLoc::getAsMDNode() // works with broken code bool DebugLoc::isUnknown() => DebugLoc::operator MDLocation *() i.e.: if (MDLocation *DL = ...) => DebugLoc::operator bool() // works with broken code i.e.: if (DebugLoc DL = ...) void DebugLoc::getScopeAndInlinedAt(MDNode *&, MDNode *&) => use: MDNode *DebugLoc::getScope() and: MDLocation *DebugLoc::getInlinedAt() MDNode *DebugLoc::getScopeNode(LLVMContext &) => MDNode *DebugLoc::getInlinedAtScope() void DebugLoc::dump(LLVMContext &) => void DebugLoc::dump() void DebugLoc::getFnDebugLoc(LLVMContext &) => void DebugLoc::getFnDebugLoc() MDNode *DebugLoc::getScope(LLVMContext &) => MDNode *DebugLoc::getScope() MDNode *DebugLoc::getInlinedAt(LLVMContext &) => MDLocation *DebugLoc::getInlinedAt() I've noted above the only functions that won't crash on broken code (due to downcasting to `MDLocation`). If your code could be dealing with broken IR (i.e., you haven't run the verifier yet, or you've used a temporary node that will eventually (but not yet) get RAUW'ed to an `MDLocation`), you need to restrict yourself to those. llvm-svn: 233599
1 parent 43006fb commit 1ceb0d2

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

llvm/include/llvm/IR/DebugLoc.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,6 @@ namespace llvm {
125125

126126
/// \brief prints source location /path/to/file.exe:line:col @[inlined at]
127127
void print(raw_ostream &OS) const;
128-
129-
// FIXME: Remove this old API once callers have been updated.
130-
static DebugLoc getFromDILocation(MDNode *N) { return DebugLoc(N); }
131-
bool isUnknown() const { return !Loc; }
132-
MDNode *getScope(const LLVMContext &) const { return getScope(); }
133-
MDNode *getInlinedAt(const LLVMContext &) const;
134-
void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA) const;
135-
void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
136-
const LLVMContext &) const {
137-
return getScopeAndInlinedAt(Scope, IA);
138-
}
139-
MDNode *getScopeNode() const { return getInlinedAtScope(); }
140-
MDNode *getScopeNode(const LLVMContext &) const { return getScopeNode(); }
141-
DebugLoc getFnDebugLoc(const LLVMContext &) const {
142-
return getFnDebugLoc();
143-
}
144-
MDNode *getAsMDNode(LLVMContext &) const { return getAsMDNode(); }
145-
void dump(const LLVMContext &) const { dump(); }
146128
};
147129

148130
} // end namespace llvm

llvm/lib/IR/DebugLoc.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,3 @@ void DebugLoc::print(raw_ostream &OS) const {
113113
OS << " ]";
114114
}
115115
}
116-
117-
// FIXME: Remove this old API once callers have been updated.
118-
MDNode *DebugLoc::getInlinedAt(const LLVMContext &) const {
119-
return getInlinedAt();
120-
}
121-
void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA) const {
122-
Scope = getScope();
123-
IA = getInlinedAt();
124-
}

0 commit comments

Comments
 (0)