MDLexicalBlockBase *operator->() const { return get(); }
MDLexicalBlockBase &operator*() const { return *get(); }
- DIScope getContext() const { return DIScope(get()->getScope()); }
- unsigned getLineNumber() const {
- if (auto *N = dyn_cast<MDLexicalBlock>(get()))
- return N->getLine();
- return 0;
- }
- unsigned getColumnNumber() const {
- if (auto *N = dyn_cast<MDLexicalBlock>(get()))
- return N->getColumn();
- return 0;
- }
+ DIScope getContext() const { return get()->getScope(); }
+ unsigned getLineNumber() const { return get()->getLine(); }
+ unsigned getColumnNumber() const { return get()->getColumn(); }
};
/// \brief This is a wrapper for a lexical block with a filename change.
Metadata *getRawScope() const { return getOperand(1); }
+ /// \brief Forwarding accessors to LexicalBlock.
+ ///
+ /// TODO: Remove these and update code to use \a MDLexicalBlock directly.
+ /// @{
+ inline unsigned getLine() const;
+ inline unsigned getColumn() const;
+ /// @}
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == MDLexicalBlockKind ||
MD->getMetadataID() == MDLexicalBlockFileKind;
}
};
+unsigned MDLexicalBlockBase::getLine() const {
+ if (auto *N = dyn_cast<MDLexicalBlock>(this))
+ return N->getLine();
+ return 0;
+}
+
+unsigned MDLexicalBlockBase::getColumn() const {
+ if (auto *N = dyn_cast<MDLexicalBlock>(this))
+ return N->getColumn();
+ return 0;
+}
+
class MDLexicalBlockFile : public MDLexicalBlockBase {
friend class LLVMContextImpl;
friend class MDNode;
TempMDLexicalBlockFile clone() const { return cloneImpl(); }
+ // TODO: Remove these once they're gone from MDLexicalBlockBase.
+ unsigned getLine() const = delete;
+ unsigned getColumn() const = delete;
+
unsigned getDiscriminator() const { return Discriminator; }
static bool classof(const Metadata *MD) {