diff options
Diffstat (limited to 'contrib/llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r-- | contrib/llvm/lib/IR/IntrinsicInst.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/llvm/lib/IR/IntrinsicInst.cpp b/contrib/llvm/lib/IR/IntrinsicInst.cpp index 67bd5b69bb0f..787889934d82 100644 --- a/contrib/llvm/lib/IR/IntrinsicInst.cpp +++ b/contrib/llvm/lib/IR/IntrinsicInst.cpp @@ -24,6 +24,7 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" @@ -44,10 +45,19 @@ Value *DbgInfoIntrinsic::getVariableLocation(bool AllowNullOp) const { return V->getValue(); // When the value goes to null, it gets replaced by an empty MDNode. - assert(!cast<MDNode>(MD)->getNumOperands() && "Expected an empty MDNode"); + assert((isa<DbgLabelInst>(this) + || !cast<MDNode>(MD)->getNumOperands()) + && "DbgValueInst Expected an empty MDNode"); + return nullptr; } +Optional<uint64_t> DbgInfoIntrinsic::getFragmentSizeInBits() const { + if (auto Fragment = getExpression()->getFragmentInfo()) + return Fragment->SizeInBits; + return getVariable()->getSizeInBits(); +} + int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable, StringRef Name) { assert(Name.startswith("llvm.")); |