diff options
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 70025c77518..2f497e9dc11 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -106,56 +106,11 @@ static MDNode *getNodeField(const MDNode *DbgNode, unsigned Elt) { return dyn_cast_or_null<MDNode>(getField(DbgNode, Elt)); } -static StringRef getStringField(const MDNode *DbgNode, unsigned Elt) { - if (MDString *MDS = dyn_cast_or_null<MDString>(getField(DbgNode, Elt))) - return MDS->getString(); - return StringRef(); -} - -StringRef DIDescriptor::getStringField(unsigned Elt) const { - return ::getStringField(DbgNode, Elt); -} - -uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const { - if (auto *C = getConstantField(Elt)) - if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) - return CI->getZExtValue(); - - return 0; -} - -int64_t DIDescriptor::getInt64Field(unsigned Elt) const { - if (auto *C = getConstantField(Elt)) - if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) - return CI->getZExtValue(); - - return 0; -} - DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const { MDNode *Field = getNodeField(DbgNode, Elt); return DIDescriptor(Field); } -GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const { - return dyn_cast_or_null<GlobalVariable>(getConstantField(Elt)); -} - -Constant *DIDescriptor::getConstantField(unsigned Elt) const { - if (!DbgNode) - return nullptr; - - if (Elt < DbgNode->getNumOperands()) - if (auto *C = - dyn_cast_or_null<ConstantAsMetadata>(DbgNode->getOperand(Elt))) - return C->getValue(); - return nullptr; -} - -Function *DIDescriptor::getFunctionField(unsigned Elt) const { - return dyn_cast_or_null<Function>(getConstantField(Elt)); -} - /// \brief Return the size reported by the variable's type. unsigned DIVariable::getSizeInBits(const DITypeIdentifierMap &Map) { DIType Ty = getType().resolve(Map); |

