[llvm] r233599 - DebugInfo: Remove dead code from old DebugLoc API
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Mar 30 14:19:50 PDT 2015
Author: dexonsmith
Date: Mon Mar 30 16:19:50 2015
New Revision: 233599
URL: http://llvm.org/viewvc/llvm-project?rev=233599&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/IR/DebugLoc.h
llvm/trunk/lib/IR/DebugLoc.cpp
Modified: llvm/trunk/include/llvm/IR/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugLoc.h?rev=233599&r1=233598&r2=233599&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugLoc.h (original)
+++ llvm/trunk/include/llvm/IR/DebugLoc.h Mon Mar 30 16:19:50 2015
@@ -125,24 +125,6 @@ namespace llvm {
/// \brief prints source location /path/to/file.exe:line:col @[inlined at]
void print(raw_ostream &OS) const;
-
- // FIXME: Remove this old API once callers have been updated.
- static DebugLoc getFromDILocation(MDNode *N) { return DebugLoc(N); }
- bool isUnknown() const { return !Loc; }
- MDNode *getScope(const LLVMContext &) const { return getScope(); }
- MDNode *getInlinedAt(const LLVMContext &) const;
- void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA) const;
- void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
- const LLVMContext &) const {
- return getScopeAndInlinedAt(Scope, IA);
- }
- MDNode *getScopeNode() const { return getInlinedAtScope(); }
- MDNode *getScopeNode(const LLVMContext &) const { return getScopeNode(); }
- DebugLoc getFnDebugLoc(const LLVMContext &) const {
- return getFnDebugLoc();
- }
- MDNode *getAsMDNode(LLVMContext &) const { return getAsMDNode(); }
- void dump(const LLVMContext &) const { dump(); }
};
} // end namespace llvm
Modified: llvm/trunk/lib/IR/DebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugLoc.cpp?rev=233599&r1=233598&r2=233599&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugLoc.cpp (original)
+++ llvm/trunk/lib/IR/DebugLoc.cpp Mon Mar 30 16:19:50 2015
@@ -113,12 +113,3 @@ void DebugLoc::print(raw_ostream &OS) co
OS << " ]";
}
}
-
-// FIXME: Remove this old API once callers have been updated.
-MDNode *DebugLoc::getInlinedAt(const LLVMContext &) const {
- return getInlinedAt();
-}
-void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA) const {
- Scope = getScope();
- IA = getInlinedAt();
-}
More information about the llvm-commits
mailing list