class DbgDeclareInst : public DbgInfoIntrinsic {
public:
Value *getAddress() const;
- MDNode *getVariable() const { return cast<MDNode>(getRawVariable()); }
- MDNode *getExpression() const { return cast<MDNode>(getRawExpression()); }
+ MDLocalVariable *getVariable() const {
+ return cast<MDLocalVariable>(getRawVariable());
+ }
+ MDExpression *getExpression() const {
+ return cast<MDExpression>(getRawExpression());
+ }
Metadata *getRawVariable() const {
return cast<MetadataAsValue>(getArgOperand(1))->getMetadata();
return cast<ConstantInt>(
const_cast<Value*>(getArgOperand(1)))->getZExtValue();
}
- MDNode *getVariable() const { return cast<MDNode>(getRawVariable()); }
- MDNode *getExpression() const { return cast<MDNode>(getRawExpression()); }
+ MDLocalVariable *getVariable() const {
+ return cast<MDLocalVariable>(getRawVariable());
+ }
+ MDExpression *getExpression() const {
+ return cast<MDExpression>(getRawExpression());
+ }
Metadata *getRawVariable() const {
return cast<MetadataAsValue>(getArgOperand(2))->getMetadata();
#define HANDLE_METADATA(CLASS) class CLASS;
#include "llvm/IR/Metadata.def"
+// Provide specializations of isa so that we don't need definitions of
+// subclasses to see if the metadata is a subclass.
+#define HANDLE_METADATA_LEAF(CLASS) \
+ template <> struct isa_impl<CLASS, Metadata> { \
+ static inline bool doit(const Metadata &MD) { \
+ return MD.getMetadataID() == Metadata::CLASS##Kind; \
+ } \
+ };
+#include "llvm/IR/Metadata.def"
+
inline raw_ostream &operator<<(raw_ostream &OS, const Metadata &MD) {
MD.print(OS);
return OS;
DII.getRawExpression());
// Don't call visitMDNode(), since that will recurse through operands.
- visitMDLocalVariable(*cast<MDLocalVariable>(DII.getVariable()));
- visitMDExpression(*cast<MDExpression>(DII.getExpression()));
+ visitMDLocalVariable(*DII.getVariable());
+ visitMDExpression(*DII.getExpression());
}
void DebugInfoVerifier::verifyDebugInfo() {