//===--- DebugInfo.cpp - Debug Information Helper Classes -----------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the helper classes used to build and interpret debug// information in LLVM IR form.////===----------------------------------------------------------------------===//#include"llvm/Analysis/DebugInfo.h"#include"llvm/Constants.h"#include"llvm/DerivedTypes.h"#include"llvm/Intrinsics.h"#include"llvm/IntrinsicInst.h"#include"llvm/Instructions.h"#include"llvm/Module.h"#include"llvm/Analysis/ValueTracking.h"#include"llvm/ADT/SmallPtrSet.h"#include"llvm/ADT/SmallString.h"#include"llvm/ADT/STLExtras.h"#include"llvm/Support/Debug.h"#include"llvm/Support/Dwarf.h"#include"llvm/Support/raw_ostream.h"usingnamespacellvm;usingnamespacellvm::dwarf;//===----------------------------------------------------------------------===//// DIDescriptor//===----------------------------------------------------------------------===//DIDescriptor::DIDescriptor(constDIFileF):DbgNode(F.DbgNode){}DIDescriptor::DIDescriptor(constDISubprogramF):DbgNode(F.DbgNode){}DIDescriptor::DIDescriptor(constDILexicalBlockFileF):DbgNode(F.DbgNode){}DIDescriptor::DIDescriptor(constDILexicalBlockF):DbgNode(F.DbgNode){}DIDescriptor::DIDescriptor(constDIVariableF):DbgNode(F.DbgNode){}DIDescriptor::DIDescriptor(constDITypeF):DbgNode(F.DbgNode){}StringRefDIDescriptor::getStringField(unsignedElt)const{if(DbgNode==0)returnStringRef();if(Elt<DbgNode->getNumOperands())if(MDString*MDS=dyn_cast_or_null<MDString>(DbgNode->getOperand(Elt)))returnMDS->getString();returnStringRef();}uint64_tDIDescriptor::getUInt64Field(unsignedElt)const{if(DbgNode==0)return0;if(Elt<DbgNode->getNumOperands())if(ConstantInt*CI=dyn_cast_or_null<ConstantInt>(DbgNode->getOperand(Elt)))returnCI->getZExtValue();return0;}DIDescriptorDIDescriptor::getDescriptorField(unsignedElt)const{if(DbgNode==0)returnDIDescriptor();if(Elt<DbgNode->getNumOperands())returnDIDescriptor(dyn_cast_or_null<constMDNode>(DbgNode->getOperand(Elt)));returnDIDescriptor();}GlobalVariable*DIDescriptor::getGlobalVariableField(unsignedElt)const{if(DbgNode==0)return0;if(Elt<DbgNode->