mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
DebugInfo: Allow DebugLocs to be constructed from const
Allow `const`-qualified pointers to be used to construct `DebugLoc`s, as a convenience. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235115 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -48,7 +48,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Construct from an \a MDLocation.
|
/// \brief Construct from an \a MDLocation.
|
||||||
DebugLoc(MDLocation *L);
|
DebugLoc(const MDLocation *L);
|
||||||
|
|
||||||
/// \brief Construct from an \a MDNode.
|
/// \brief Construct from an \a MDNode.
|
||||||
///
|
///
|
||||||
@@ -56,7 +56,7 @@ namespace llvm {
|
|||||||
/// accessors will crash. However, construction from other nodes is
|
/// accessors will crash. However, construction from other nodes is
|
||||||
/// supported in order to handle forward references when reading textual
|
/// supported in order to handle forward references when reading textual
|
||||||
/// IR.
|
/// IR.
|
||||||
explicit DebugLoc(MDNode *N);
|
explicit DebugLoc(const MDNode *N);
|
||||||
|
|
||||||
/// \brief Get the underlying \a MDLocation.
|
/// \brief Get the underlying \a MDLocation.
|
||||||
///
|
///
|
||||||
@@ -87,8 +87,8 @@ namespace llvm {
|
|||||||
/// If \c !Scope, returns a default-constructed \a DebugLoc.
|
/// If \c !Scope, returns a default-constructed \a DebugLoc.
|
||||||
///
|
///
|
||||||
/// FIXME: Remove this. Users should use MDLocation::get().
|
/// FIXME: Remove this. Users should use MDLocation::get().
|
||||||
static DebugLoc get(unsigned Line, unsigned Col, MDNode *Scope,
|
static DebugLoc get(unsigned Line, unsigned Col, const MDNode *Scope,
|
||||||
MDNode *InlinedAt = nullptr);
|
const MDNode *InlinedAt = nullptr);
|
||||||
|
|
||||||
unsigned getLine() const;
|
unsigned getLine() const;
|
||||||
unsigned getCol() const;
|
unsigned getCol() const;
|
||||||
|
@@ -16,8 +16,8 @@ using namespace llvm;
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// DebugLoc Implementation
|
// DebugLoc Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
DebugLoc::DebugLoc(MDLocation *L) : Loc(L) {}
|
DebugLoc::DebugLoc(const MDLocation *L) : Loc(const_cast<MDLocation *>(L)) {}
|
||||||
DebugLoc::DebugLoc(MDNode *L) : Loc(L) {}
|
DebugLoc::DebugLoc(const MDNode *L) : Loc(const_cast<MDNode *>(L)) {}
|
||||||
|
|
||||||
MDLocation *DebugLoc::get() const {
|
MDLocation *DebugLoc::get() const {
|
||||||
return cast_or_null<MDLocation>(Loc.get());
|
return cast_or_null<MDLocation>(Loc.get());
|
||||||
@@ -56,13 +56,15 @@ DebugLoc DebugLoc::getFnDebugLoc() const {
|
|||||||
return DebugLoc();
|
return DebugLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
|
DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope,
|
||||||
MDNode *Scope, MDNode *InlinedAt) {
|
const MDNode *InlinedAt) {
|
||||||
// If no scope is available, this is an unknown location.
|
// If no scope is available, this is an unknown location.
|
||||||
if (!Scope)
|
if (!Scope)
|
||||||
return DebugLoc();
|
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 {
|
void DebugLoc::dump() const {
|
||||||
|
Reference in New Issue
Block a user