本文整理汇总了C++中DISubprogram::getLineNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ DISubprogram::getLineNumber方法的具体用法?C++ DISubprogram::getLineNumber怎么用?C++ DISubprogram::getLineNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DISubprogram
的用法示例。
在下文中一共展示了DISubprogram::getLineNumber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmpDISP
bool cmpDISP(const DISubprogram & SP1, const DISubprogram & SP2)
{
int cmp = SP1.getDirectory().compare(SP2.getDirectory());
if (cmp == 0) {
cmp = SP1.getFilename().compare(SP2.getFilename());
if (cmp == 0) {
cmp = SP1.getLineNumber() - SP2.getLineNumber();
}
}
return cmp >= 0 ? false : true;
}
示例2: addSourceLine
/// addSourceLine - Add location information to specified debug information
/// entry.
void CompileUnit::addSourceLine(DIE *Die, DISubprogram SP) {
// Verify subprogram.
if (!SP.Verify())
return;
// If the line number is 0, don't add it.
if (SP.getLineNumber() == 0)
return;
unsigned Line = SP.getLineNumber();
if (!SP.getContext().Verify())
return;
unsigned FileID = DD->GetOrCreateSourceID(SP.getFilename(), SP.getDirectory());
assert(FileID && "Invalid file id");
addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);
addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);
}
示例3: addFunction
void DebugDatabase::addFunction(MDNode *subprogram, GenerateRTL *hw) {
string name;
DISubprogram s;
assert(subprogram || hw);
if (subprogram) {
s = DISubprogram(subprogram);
name = s.getName().str();
}
if (hw) {
// dbgs() << "Adding function " <<
// hw->getFunction()->getName().str() << "\n";
if (hwToFunctionIds.find(hw) != hwToFunctionIds.end()) {
// This function has already been added
// This can happen since we add functions with metadata first, then
// add all functions with hardware next. Those with metadata will
// have
// already been added
// dbgs() << "exiting\n";
return;
} else {
// dbgs() << "not exiting\n";
}
if (subprogram) {
assert(name == hw->getFunction()->getName().str());
} else {
name = hw->getFunction()->getName().str();
}
}
std::string query = "INSERT INTO Function (designId, name, inlined, "
"hasMetadata, startLineNumber) ";
query += "VALUES (" + std::to_string(designId);
query += "," + addQuotesToStr(name);
query += "," + std::to_string(hw ? false : true);
query += "," + std::to_string(subprogram ? true : false);
query += "," + (subprogram ? std::to_string(s.getLineNumber()) : "NULL");
query += ");";
runQuery(query);
int functionId = mysql_insert_id(connection);
if (subprogram) {
subprogramsToFunctionIds[subprogram] = functionId;
}
if (hw) {
hwToFunctionIds[hw] = functionId;
}
}
示例4: getFnDebugLoc
DebugLoc DebugLoc::getFnDebugLoc(const LLVMContext &Ctx) {
const MDNode *Scope = getScopeNode(Ctx);
DISubprogram SP = getDISubprogram(Scope);
if (SP.isSubprogram()) {
// Check for number of operands since the compatibility is
// cheap here. FIXME: Name the magic constant.
if (SP->getNumOperands() > 19)
return DebugLoc::get(SP.getScopeLineNumber(), 0, SP);
else
return DebugLoc::get(SP.getLineNumber(), 0, SP);
}
return DebugLoc();
}