/// createVariable - Create a new descriptor for the specified variable. DIVariable DIBuilder::createLocalVariable(unsigned Tag, DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNo, DIType Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) { DIDescriptor Context(getNonCompileUnitScope(Scope)); assert((!Context || Context.Verify()) && "createLocalVariable should be called with a valid Context"); assert(Ty.Verify() && "createLocalVariable should be called with a valid type"); Value *Elts[] = { GetTagConstant(VMContext, Tag), getNonCompileUnitScope(Scope), MDString::get(VMContext, Name), File, ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))), Ty, ConstantInt::get(Type::getInt32Ty(VMContext), Flags), Constant::getNullValue(Type::getInt32Ty(VMContext)) }; MDNode *Node = MDNode::get(VMContext, Elts); if (AlwaysPreserve) { // The optimizer may remove local variable. If there is an interest // to preserve variable info in such situation then stash it in a // named mdnode. DISubprogram Fn(getDISubprogram(Scope)); NamedMDNode *FnLocals = getOrInsertFnSpecificMDNode(M, Fn); FnLocals->addOperand(Node); } assert(DIVariable(Node).Verify() && "createLocalVariable should return a verifiable DIVariable"); return DIVariable(Node); }
/// createFriend - Create debugging information entry for a 'friend'. DIType DIBuilder::createFriend(DIType Ty, DIType FriendTy) { // typedefs are encoded in DIDerivedType format. assert(Ty.Verify() && "Invalid type!"); assert(FriendTy.Verify() && "Invalid friend type!"); Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_friend), Ty, NULL, // Name Ty.getFile(), ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags FriendTy }; return DIType(MDNode::get(VMContext, Elts)); }
/// Verify - Verify that an ObjC property is well formed. bool DIObjCProperty::Verify() const { if (!isObjCProperty()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; // Don't worry about the rest of the strings for now. return DbgNode->getNumOperands() == 8; }
/// Verify - Verify that an ObjC property is well formed. bool DIObjCProperty::Verify() const { if (!DbgNode) return false; unsigned Tag = getTag(); if (Tag != dwarf::DW_TAG_APPLE_property) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; // Don't worry about the rest of the strings for now. return true; }
/// Verify - Verify that a variable descriptor is well formed. bool DIVariable::Verify() const { if (!DbgNode) return false; if (getContext() && !getContext().Verify()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; return true; }
/// Verify - Verify that a variable descriptor is well formed. bool DIVariable::Verify() const { if (isNull()) return false; if (getContext().isNull()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; return true; }
/// Verify - Verify that a variable descriptor is well formed. bool DIVariable::Verify() const { if (!isVariable()) return false; if (getContext() && !getContext().Verify()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; return DbgNode->getNumOperands() >= 8; }
/// addSourceLine - Add location information to specified debug information /// entry. void CompileUnit::addSourceLine(DIE *Die, DIType Ty) { // Verify type. if (!Ty.Verify()) return; unsigned Line = Ty.getLineNumber(); if (Line == 0 || !Ty.getContext().Verify()) return; unsigned FileID = DD->GetOrCreateSourceID(Ty.getFilename(), Ty.getDirectory()); assert(FileID && "Invalid file id"); addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID); addUInt(Die, dwarf::DW_AT_decl_line, 0, Line); }
/// Verify - Verify that a global variable descriptor is well formed. bool DIGlobalVariable::Verify() const { if (!isGlobalVariable()) return false; if (getDisplayName().empty()) return false; if (getContext() && !getContext().Verify()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; return DbgNode->getNumOperands() == 13; }
/// createReferenceType - Create debugging information entry for a reference /// type. DIType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) { assert(RTy.Verify() && "Unable to create reference type"); // References are encoded in DIDerivedType format. Value *Elts[] = { GetTagConstant(VMContext, Tag), NULL, // TheCU, NULL, // Name NULL, // Filename ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags RTy }; return DIType(MDNode::get(VMContext, Elts)); }
/// createInheritance - Create debugging information entry to establish /// inheritance relationship between two types. DIType DIBuilder::createInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset, unsigned Flags) { assert(Ty.Verify() && "Unable to create inheritance"); // TAG_inheritance is encoded in DIDerivedType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_inheritance), Ty, NULL, // Name Ty.getFile(), ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align ConstantInt::get(Type::getInt64Ty(VMContext), BaseOffset), ConstantInt::get(Type::getInt32Ty(VMContext), Flags), BaseTy }; return DIType(MDNode::get(VMContext, Elts)); }
/// createTypedef - Create debugging information entry for a typedef. DIType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File, unsigned LineNo, DIDescriptor Context) { // typedefs are encoded in DIDerivedType format. assert(Ty.Verify() && "Invalid typedef type!"); Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_typedef), getNonCompileUnitScope(Context), MDString::get(VMContext, Name), File, ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags Ty }; return DIType(MDNode::get(VMContext, Elts)); }
/// Verify - Verify that a global variable descriptor is well formed. bool DIGlobalVariable::Verify() const { if (!DbgNode) return false; if (getDisplayName().empty()) return false; if (getContext() && !getContext().Verify()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; if (!getGlobal() && !getConstant()) return false; return true; }
/// Verify - Verify that a global variable descriptor is well formed. bool DIGlobalVariable::Verify() const { if (isNull()) return false; if (!getDisplayName()) return false; if (getContext().isNull()) return false; DICompileUnit CU = getCompileUnit(); if (!CU.isNull() && !CU.Verify()) return false; DIType Ty = getType(); if (!Ty.Verify()) return false; if (!getGlobal()) return false; return true; }
/// addType - Add a new type attribute to the specified entity. void CompileUnit::addType(DIE *Entity, DIType Ty) { if (!Ty.Verify()) return; // Check for pre-existence. DIEEntry *Entry = getDIEEntry(Ty); // If it exists then use the existing value. if (Entry) { Entity->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, Entry); return; } // Construct type. DIE *Buffer = getOrCreateTypeDIE(Ty); // Set up proxy. Entry = createDIEEntry(Buffer); insertDIEEntry(Ty, Entry); Entity->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, Entry); // If this is a complete composite type then include it in the // list of global types. addGlobalType(Ty); }