mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
DebugInfo: Reorder definitions of MDLocation and MDFile, NFC
Move definition of `MDLocation` after `MDLocalScope` so that the latter is available for casts in the former. Similarly, move the definition of `MDFile` as early as possible so that other classes can cast to it in their definitions. (Follow-up commits will take advantage of this.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
15a873a6e2
commit
1329ecfc78
@ -41,53 +41,6 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
/// \brief Debug location.
|
|
||||||
///
|
|
||||||
/// A debug location in source code, used for debug info and otherwise.
|
|
||||||
class MDLocation : public MDNode {
|
|
||||||
friend class LLVMContextImpl;
|
|
||||||
friend class MDNode;
|
|
||||||
|
|
||||||
MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
|
|
||||||
unsigned Column, ArrayRef<Metadata *> MDs);
|
|
||||||
~MDLocation() { dropAllReferences(); }
|
|
||||||
|
|
||||||
static MDLocation *getImpl(LLVMContext &Context, unsigned Line,
|
|
||||||
unsigned Column, Metadata *Scope,
|
|
||||||
Metadata *InlinedAt, StorageType Storage,
|
|
||||||
bool ShouldCreate = true);
|
|
||||||
|
|
||||||
TempMDLocation cloneImpl() const {
|
|
||||||
return getTemporary(getContext(), getLine(), getColumn(), getScope(),
|
|
||||||
getInlinedAt());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disallow replacing operands.
|
|
||||||
void replaceOperandWith(unsigned I, Metadata *New) = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DEFINE_MDNODE_GET(MDLocation,
|
|
||||||
(unsigned Line, unsigned Column, Metadata *Scope,
|
|
||||||
Metadata *InlinedAt = nullptr),
|
|
||||||
(Line, Column, Scope, InlinedAt))
|
|
||||||
|
|
||||||
/// \brief Return a (temporary) clone of this.
|
|
||||||
TempMDLocation clone() const { return cloneImpl(); }
|
|
||||||
|
|
||||||
unsigned getLine() const { return SubclassData32; }
|
|
||||||
unsigned getColumn() const { return SubclassData16; }
|
|
||||||
Metadata *getScope() const { return getOperand(0); }
|
|
||||||
Metadata *getInlinedAt() const {
|
|
||||||
if (getNumOperands() == 2)
|
|
||||||
return getOperand(1);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool classof(const Metadata *MD) {
|
|
||||||
return MD->getMetadataID() == MDLocationKind;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \brief Tagged DWARF-like metadata node.
|
/// \brief Tagged DWARF-like metadata node.
|
||||||
///
|
///
|
||||||
/// A metadata node with a DWARF tag (i.e., a constant named \c DW_TAG_*,
|
/// A metadata node with a DWARF tag (i.e., a constant named \c DW_TAG_*,
|
||||||
@ -359,6 +312,52 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief File.
|
||||||
|
///
|
||||||
|
/// TODO: Merge with directory/file node (including users).
|
||||||
|
/// TODO: Canonicalize paths on creation.
|
||||||
|
class MDFile : public MDScope {
|
||||||
|
friend class LLVMContextImpl;
|
||||||
|
friend class MDNode;
|
||||||
|
|
||||||
|
MDFile(LLVMContext &C, StorageType Storage, ArrayRef<Metadata *> Ops)
|
||||||
|
: MDScope(C, MDFileKind, Storage, dwarf::DW_TAG_file_type, Ops) {}
|
||||||
|
~MDFile() {}
|
||||||
|
|
||||||
|
static MDFile *getImpl(LLVMContext &Context, StringRef Filename,
|
||||||
|
StringRef Directory, StorageType Storage,
|
||||||
|
bool ShouldCreate = true) {
|
||||||
|
return getImpl(Context, getCanonicalMDString(Context, Filename),
|
||||||
|
getCanonicalMDString(Context, Directory), Storage,
|
||||||
|
ShouldCreate);
|
||||||
|
}
|
||||||
|
static MDFile *getImpl(LLVMContext &Context, MDString *Filename,
|
||||||
|
MDString *Directory, StorageType Storage,
|
||||||
|
bool ShouldCreate = true);
|
||||||
|
|
||||||
|
TempMDFile cloneImpl() const {
|
||||||
|
return getTemporary(getContext(), getFilename(), getDirectory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
DEFINE_MDNODE_GET(MDFile, (StringRef Filename, StringRef Directory),
|
||||||
|
(Filename, Directory))
|
||||||
|
DEFINE_MDNODE_GET(MDFile, (MDString * Filename, MDString *Directory),
|
||||||
|
(Filename, Directory))
|
||||||
|
|
||||||
|
TempMDFile clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
|
StringRef getFilename() const { return getStringOperand(0); }
|
||||||
|
StringRef getDirectory() const { return getStringOperand(1); }
|
||||||
|
|
||||||
|
MDString *getRawFilename() const { return getOperandAs<MDString>(0); }
|
||||||
|
MDString *getRawDirectory() const { return getOperandAs<MDString>(1); }
|
||||||
|
|
||||||
|
static bool classof(const Metadata *MD) {
|
||||||
|
return MD->getMetadataID() == MDFileKind;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// \brief Base class for types.
|
/// \brief Base class for types.
|
||||||
///
|
///
|
||||||
/// TODO: Remove the hardcoded name and context, since many types don't use
|
/// TODO: Remove the hardcoded name and context, since many types don't use
|
||||||
@ -738,52 +737,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief File.
|
|
||||||
///
|
|
||||||
/// TODO: Merge with directory/file node (including users).
|
|
||||||
/// TODO: Canonicalize paths on creation.
|
|
||||||
class MDFile : public MDScope {
|
|
||||||
friend class LLVMContextImpl;
|
|
||||||
friend class MDNode;
|
|
||||||
|
|
||||||
MDFile(LLVMContext &C, StorageType Storage, ArrayRef<Metadata *> Ops)
|
|
||||||
: MDScope(C, MDFileKind, Storage, dwarf::DW_TAG_file_type, Ops) {}
|
|
||||||
~MDFile() {}
|
|
||||||
|
|
||||||
static MDFile *getImpl(LLVMContext &Context, StringRef Filename,
|
|
||||||
StringRef Directory, StorageType Storage,
|
|
||||||
bool ShouldCreate = true) {
|
|
||||||
return getImpl(Context, getCanonicalMDString(Context, Filename),
|
|
||||||
getCanonicalMDString(Context, Directory), Storage,
|
|
||||||
ShouldCreate);
|
|
||||||
}
|
|
||||||
static MDFile *getImpl(LLVMContext &Context, MDString *Filename,
|
|
||||||
MDString *Directory, StorageType Storage,
|
|
||||||
bool ShouldCreate = true);
|
|
||||||
|
|
||||||
TempMDFile cloneImpl() const {
|
|
||||||
return getTemporary(getContext(), getFilename(), getDirectory());
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
DEFINE_MDNODE_GET(MDFile, (StringRef Filename, StringRef Directory),
|
|
||||||
(Filename, Directory))
|
|
||||||
DEFINE_MDNODE_GET(MDFile, (MDString * Filename, MDString *Directory),
|
|
||||||
(Filename, Directory))
|
|
||||||
|
|
||||||
TempMDFile clone() const { return cloneImpl(); }
|
|
||||||
|
|
||||||
StringRef getFilename() const { return getStringOperand(0); }
|
|
||||||
StringRef getDirectory() const { return getStringOperand(1); }
|
|
||||||
|
|
||||||
MDString *getRawFilename() const { return getOperandAs<MDString>(0); }
|
|
||||||
MDString *getRawDirectory() const { return getOperandAs<MDString>(1); }
|
|
||||||
|
|
||||||
static bool classof(const Metadata *MD) {
|
|
||||||
return MD->getMetadataID() == MDFileKind;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \brief Compile unit.
|
/// \brief Compile unit.
|
||||||
class MDCompileUnit : public MDScope {
|
class MDCompileUnit : public MDScope {
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
@ -914,6 +867,53 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief Debug location.
|
||||||
|
///
|
||||||
|
/// A debug location in source code, used for debug info and otherwise.
|
||||||
|
class MDLocation : public MDNode {
|
||||||
|
friend class LLVMContextImpl;
|
||||||
|
friend class MDNode;
|
||||||
|
|
||||||
|
MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||||
|
unsigned Column, ArrayRef<Metadata *> MDs);
|
||||||
|
~MDLocation() { dropAllReferences(); }
|
||||||
|
|
||||||
|
static MDLocation *getImpl(LLVMContext &Context, unsigned Line,
|
||||||
|
unsigned Column, Metadata *Scope,
|
||||||
|
Metadata *InlinedAt, StorageType Storage,
|
||||||
|
bool ShouldCreate = true);
|
||||||
|
|
||||||
|
TempMDLocation cloneImpl() const {
|
||||||
|
return getTemporary(getContext(), getLine(), getColumn(), getScope(),
|
||||||
|
getInlinedAt());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disallow replacing operands.
|
||||||
|
void replaceOperandWith(unsigned I, Metadata *New) = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DEFINE_MDNODE_GET(MDLocation,
|
||||||
|
(unsigned Line, unsigned Column, Metadata *Scope,
|
||||||
|
Metadata *InlinedAt = nullptr),
|
||||||
|
(Line, Column, Scope, InlinedAt))
|
||||||
|
|
||||||
|
/// \brief Return a (temporary) clone of this.
|
||||||
|
TempMDLocation clone() const { return cloneImpl(); }
|
||||||
|
|
||||||
|
unsigned getLine() const { return SubclassData32; }
|
||||||
|
unsigned getColumn() const { return SubclassData16; }
|
||||||
|
Metadata *getScope() const { return getOperand(0); }
|
||||||
|
Metadata *getInlinedAt() const {
|
||||||
|
if (getNumOperands() == 2)
|
||||||
|
return getOperand(1);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool classof(const Metadata *MD) {
|
||||||
|
return MD->getMetadataID() == MDLocationKind;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// \brief Subprogram description.
|
/// \brief Subprogram description.
|
||||||
///
|
///
|
||||||
/// TODO: Remove DisplayName. It's always equal to Name.
|
/// TODO: Remove DisplayName. It's always equal to Name.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user