本文整理汇总了C++中DiagnosticsEngine::hasFatalErrorOccurred方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagnosticsEngine::hasFatalErrorOccurred方法的具体用法?C++ DiagnosticsEngine::hasFatalErrorOccurred怎么用?C++ DiagnosticsEngine::hasFatalErrorOccurred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagnosticsEngine
的用法示例。
在下文中一共展示了DiagnosticsEngine::hasFatalErrorOccurred方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assembler
static int
do_assemble(SourceManager& source_mgr, DiagnosticsEngine& diags)
{
// Apply warning settings
ApplyWarningSettings(diags);
// Determine objfmt_bits based on -32 and -64 options
std::string objfmt_bits = GetBitsSetting();
FileManager& file_mgr = source_mgr.getFileManager();
Assembler assembler("x86", YGAS_OBJFMT_BASE + objfmt_bits, diags,
dump_object);
HeaderSearch headers(file_mgr);
if (diags.hasFatalErrorOccurred())
return EXIT_FAILURE;
// Set object filename if specified.
if (!obj_filename.empty())
assembler.setObjectFilename(obj_filename);
// Set parser.
assembler.setParser("gas", diags);
if (diags.hasFatalErrorOccurred())
return EXIT_FAILURE;
// Set debug format to dwarf2pass if it's legal for this object format.
if (assembler.isOkDebugFormat("dwarf2pass"))
{
assembler.setDebugFormat("dwarf2pass", diags);
if (diags.hasFatalErrorOccurred())
return EXIT_FAILURE;
}
// open the input file or STDIN (for filename of "-")
if (in_filename == "-")
{
OwningPtr<MemoryBuffer> my_stdin;
if (llvm::error_code err = MemoryBuffer::getSTDIN(my_stdin))
{
diags.Report(SourceLocation(), diag::fatal_file_open)
<< in_filename << err.message();
return EXIT_FAILURE;
}
source_mgr.createMainFileIDForMemBuffer(my_stdin.take());
}
else
{
const FileEntry* in = file_mgr.getFile(in_filename);
if (!in)
{
diags.Report(SourceLocation(), diag::fatal_file_open)
<< in_filename;
return EXIT_FAILURE;
}
source_mgr.createMainFileID(in);
}
// Initialize the object.
if (!assembler.InitObject(source_mgr, diags))
return EXIT_FAILURE;
// Configure object per command line parameters.
ConfigureObject(*assembler.getObject());
// Predefine symbols.
for (std::vector<std::string>::const_iterator i=defsym.begin(),
end=defsym.end(); i != end; ++i)
{
StringRef str(*i);
size_t equalpos = str.find('=');
if (equalpos == StringRef::npos)
{
diags.Report(diag::fatal_bad_defsym) << str;
continue;
}
StringRef name = str.slice(0, equalpos);
StringRef vstr = str.slice(equalpos+1, StringRef::npos);
IntNum value;
if (!vstr.empty())
{
// determine radix
unsigned int radix;
if (vstr[0] == '0' && vstr.size() > 1 &&
(vstr[1] == 'x' || vstr[1] == 'X'))
{
vstr = vstr.substr(2);
radix = 16;
}
else if (vstr[0] == '0')
{
vstr = vstr.substr(1);
radix = 8;
}
else
radix = 10;
// check validity
//.........这里部分代码省略.........