本文整理汇总了C++中StringTable::getIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ StringTable::getIndex方法的具体用法?C++ StringTable::getIndex怎么用?C++ StringTable::getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTable
的用法示例。
在下文中一共展示了StringTable::getIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
}
else
{
scnum = 0xffff; // -1 = absolute symbol
value = 0;
}
// add in any remaining absolute portion
if (Expr* abs = val.getAbs())
{
SimplifyCalcDist(*abs, diags);
if (abs->isIntNum())
value += abs->getIntNum();
else
diags.Report(sym.getDefSource(), diag::err_equ_not_integer);
}
}
}
else
{
if (vis & Symbol::COMMON)
{
assert(getCommonSize(sym) != 0);
Expr csize(*getCommonSize(sym));
SimplifyCalcDist(csize, diags);
if (csize.isIntNum())
value = csize.getIntNum();
else
{
diags.Report(sym.getDefSource(),
diag::err_common_size_not_integer);
}
scnum = 0;
}
if (vis & Symbol::EXTERN)
scnum = 0;
}
bytes.setLittleEndian();
StringRef name;
if (sym.isAbsoluteSymbol())
name = ".absolut";
else
name = sym.getName();
size_t len = name.size();
if (len > 8)
{
Write32(bytes, 0); // "zeros" field
Write32(bytes, strtab.getIndex(name)); // strtab offset
}
else
{
// <8 chars, so no string table entry needed
bytes.WriteString(name);
bytes.Write(8-len, 0);
}
Write32(bytes, value); // value
Write16(bytes, scnum); // section number
Write16(bytes, m_type); // type
Write8(bytes, m_sclass); // storage class
Write8(bytes, m_aux.size()); // number of aux entries
assert(bytes.size() == 18);
for (std::vector<AuxEntry>::const_iterator i=m_aux.begin(), end=m_aux.end();
i != end; ++i)
{
switch (m_auxtype)
{
case AUX_NONE:
bytes.Write(18, 0);
break;
case AUX_SECT:
Write32(bytes, scnlen); // section length
Write16(bytes, nreloc); // number relocs
bytes.Write(12, 0); // number line nums, 0 fill
break;
case AUX_FILE:
len = i->fname.length();
if (len > 18)
{
Write32(bytes, 0);
Write32(bytes, strtab.getIndex(i->fname));
bytes.Write(18-8, 0);
}
else
{
bytes.WriteString(i->fname);
bytes.Write(18-len, 0);
}
break;
default:
assert(false); // unrecognized aux symtab type
}
}
assert(bytes.size() == 18+18*m_aux.size());
}