Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
Show First 20 Lines • Show All 1,390 Lines • ▼ Show 20 Lines | |||||
/// Debug location. | /// Debug location. | ||||
/// | /// | ||||
/// A debug location in source code, used for debug info and otherwise. | /// A debug location in source code, used for debug info and otherwise. | ||||
class DILocation : public MDNode { | class DILocation : public MDNode { | ||||
friend class LLVMContextImpl; | friend class LLVMContextImpl; | ||||
friend class MDNode; | friend class MDNode; | ||||
DILocation(LLVMContext &C, StorageType Storage, unsigned Line, | DILocation(LLVMContext &C, StorageType Storage, unsigned Line, | ||||
unsigned Column, ArrayRef<Metadata *> MDs); | unsigned Column, ArrayRef<Metadata *> MDs, bool ImplicitCode); | ||||
~DILocation() { dropAllReferences(); } | ~DILocation() { dropAllReferences(); } | ||||
static DILocation *getImpl(LLVMContext &Context, unsigned Line, | static DILocation *getImpl(LLVMContext &Context, unsigned Line, | ||||
unsigned Column, Metadata *Scope, | unsigned Column, Metadata *Scope, | ||||
Metadata *InlinedAt, StorageType Storage, | Metadata *InlinedAt, bool ImplicitCode, | ||||
bool ShouldCreate = true); | StorageType Storage, bool ShouldCreate = true); | ||||
static DILocation *getImpl(LLVMContext &Context, unsigned Line, | static DILocation *getImpl(LLVMContext &Context, unsigned Line, | ||||
unsigned Column, DILocalScope *Scope, | unsigned Column, DILocalScope *Scope, | ||||
DILocation *InlinedAt, StorageType Storage, | DILocation *InlinedAt, bool ImplicitCode, | ||||
bool ShouldCreate = true) { | StorageType Storage, bool ShouldCreate = true) { | ||||
return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope), | return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope), | ||||
static_cast<Metadata *>(InlinedAt), Storage, ShouldCreate); | static_cast<Metadata *>(InlinedAt), ImplicitCode, Storage, | ||||
ShouldCreate); | |||||
} | } | ||||
/// With a given unsigned int \p U, use up to 13 bits to represent it. | /// With a given unsigned int \p U, use up to 13 bits to represent it. | ||||
/// old_bit 1~5 --> new_bit 1~5 | /// old_bit 1~5 --> new_bit 1~5 | ||||
/// old_bit 6~12 --> new_bit 7~13 | /// old_bit 6~12 --> new_bit 7~13 | ||||
/// new_bit_6 is 0 if higher bits (7~13) are all 0 | /// new_bit_6 is 0 if higher bits (7~13) are all 0 | ||||
static unsigned getPrefixEncodingFromUnsigned(unsigned U) { | static unsigned getPrefixEncodingFromUnsigned(unsigned U) { | ||||
U &= 0xfff; | U &= 0xfff; | ||||
Show All 12 Lines | static unsigned getNextComponentInDiscriminator(unsigned D) { | ||||
else | else | ||||
return D >> 1; | return D >> 1; | ||||
} | } | ||||
TempDILocation cloneImpl() const { | TempDILocation cloneImpl() const { | ||||
// Get the raw scope/inlinedAt since it is possible to invoke this on | // Get the raw scope/inlinedAt since it is possible to invoke this on | ||||
// a DILocation containing temporary metadata. | // a DILocation containing temporary metadata. | ||||
return getTemporary(getContext(), getLine(), getColumn(), getRawScope(), | return getTemporary(getContext(), getLine(), getColumn(), getRawScope(), | ||||
getRawInlinedAt()); | getRawInlinedAt(), isImplicitCode()); | ||||
} | } | ||||
public: | public: | ||||
// Disallow replacing operands. | // Disallow replacing operands. | ||||
void replaceOperandWith(unsigned I, Metadata *New) = delete; | void replaceOperandWith(unsigned I, Metadata *New) = delete; | ||||
DEFINE_MDNODE_GET(DILocation, | DEFINE_MDNODE_GET(DILocation, | ||||
(unsigned Line, unsigned Column, Metadata *Scope, | (unsigned Line, unsigned Column, Metadata *Scope, | ||||
Metadata *InlinedAt = nullptr), | Metadata *InlinedAt = nullptr, bool ImplicitCode = false), | ||||
(Line, Column, Scope, InlinedAt)) | (Line, Column, Scope, InlinedAt, ImplicitCode)) | ||||
DEFINE_MDNODE_GET(DILocation, | DEFINE_MDNODE_GET(DILocation, | ||||
(unsigned Line, unsigned Column, DILocalScope *Scope, | (unsigned Line, unsigned Column, DILocalScope *Scope, | ||||
DILocation *InlinedAt = nullptr), | DILocation *InlinedAt = nullptr, | ||||
(Line, Column, Scope, InlinedAt)) | bool ImplicitCode = false), | ||||
(Line, Column, Scope, InlinedAt, ImplicitCode)) | |||||
/// Return a (temporary) clone of this. | /// Return a (temporary) clone of this. | ||||
TempDILocation clone() const { return cloneImpl(); } | TempDILocation clone() const { return cloneImpl(); } | ||||
unsigned getLine() const { return SubclassData32; } | unsigned getLine() const { return SubclassData32; } | ||||
unsigned getColumn() const { return SubclassData16; } | unsigned getColumn() const { return SubclassData16; } | ||||
DILocalScope *getScope() const { return cast<DILocalScope>(getRawScope()); } | DILocalScope *getScope() const { return cast<DILocalScope>(getRawScope()); } | ||||
DILocation *getInlinedAt() const { | DILocation *getInlinedAt() const { | ||||
return cast_or_null<DILocation>(getRawInlinedAt()); | return cast_or_null<DILocation>(getRawInlinedAt()); | ||||
} | } | ||||
/// Check if the location corresponds to an implicit code. | |||||
/// When the ImplicitCode flag is true, it means that the Instruction | |||||
/// with this DILocation has been added by the front-end but it hasn't been | |||||
/// written explicitly by the user (e.g. cleanup stuff in C++ put on a closing | |||||
/// bracket). It's useful for code coverage to not show a counter on "empty" | |||||
/// lines. | |||||
bool isImplicitCode() const { return ImplicitCode; } | |||||
void setImplicitCode(bool ImplicitCode) { this->ImplicitCode = ImplicitCode; } | |||||
DIFile *getFile() const { return getScope()->getFile(); } | DIFile *getFile() const { return getScope()->getFile(); } | ||||
StringRef getFilename() const { return getScope()->getFilename(); } | StringRef getFilename() const { return getScope()->getFilename(); } | ||||
StringRef getDirectory() const { return getScope()->getDirectory(); } | StringRef getDirectory() const { return getScope()->getDirectory(); } | ||||
Optional<StringRef> getSource() const { return getScope()->getSource(); } | Optional<StringRef> getSource() const { return getScope()->getSource(); } | ||||
/// Get the scope where this is inlined. | /// Get the scope where this is inlined. | ||||
/// | /// | ||||
/// Walk through \a getInlinedAt() and return \a getScope() from the deepest | /// Walk through \a getInlinedAt() and return \a getScope() from the deepest | ||||
▲ Show 20 Lines • Show All 1,620 Lines • Show Last 20 Lines |