summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugLoc.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-16 16:56:29 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-16 16:56:29 +0000
commit5c8f1dc27402a31a2ec35a74b80729e0d555e276 (patch)
treeeaa6d98beee898173837805fab2d2e37084072a2 /llvm/lib/IR/DebugLoc.cpp
parent3ee81964ea85ff004ec29f56d4c6a436d87d5ce4 (diff)
downloadbcm5719-llvm-5c8f1dc27402a31a2ec35a74b80729e0d555e276.tar.gz
bcm5719-llvm-5c8f1dc27402a31a2ec35a74b80729e0d555e276.zip
DebugInfo: Allow DebugLocs to be constructed from const
Allow `const`-qualified pointers to be used to construct `DebugLoc`s, as a convenience. llvm-svn: 235115
Diffstat (limited to 'llvm/lib/IR/DebugLoc.cpp')
-rw-r--r--llvm/lib/IR/DebugLoc.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/IR/DebugLoc.cpp b/llvm/lib/IR/DebugLoc.cpp
index d9229483d05..4cf7e9e34e1 100644
--- a/llvm/lib/IR/DebugLoc.cpp
+++ b/llvm/lib/IR/DebugLoc.cpp
@@ -16,8 +16,8 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
// DebugLoc Implementation
//===----------------------------------------------------------------------===//
-DebugLoc::DebugLoc(MDLocation *L) : Loc(L) {}
-DebugLoc::DebugLoc(MDNode *L) : Loc(L) {}
+DebugLoc::DebugLoc(const MDLocation *L) : Loc(const_cast<MDLocation *>(L)) {}
+DebugLoc::DebugLoc(const MDNode *L) : Loc(const_cast<MDNode *>(L)) {}
MDLocation *DebugLoc::get() const {
return cast_or_null<MDLocation>(Loc.get());
@@ -56,13 +56,15 @@ DebugLoc DebugLoc::getFnDebugLoc() const {
return DebugLoc();
}
-DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
- MDNode *Scope, MDNode *InlinedAt) {
+DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope,
+ const MDNode *InlinedAt) {
// If no scope is available, this is an unknown location.
if (!Scope)
return DebugLoc();
- return MDLocation::get(Scope->getContext(), Line, Col, Scope, InlinedAt);
+ return MDLocation::get(Scope->getContext(), Line, Col,
+ const_cast<MDNode *>(Scope),
+ const_cast<MDNode *>(InlinedAt));
}
void DebugLoc::dump() const {
OpenPOWER on IntegriCloud