本文整理汇总了C++中TextDiagnosticBuffer::err_begin方法的典型用法代码示例。如果您正苦于以下问题:C++ TextDiagnosticBuffer::err_begin方法的具体用法?C++ TextDiagnosticBuffer::err_begin怎么用?C++ TextDiagnosticBuffer::err_begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextDiagnosticBuffer
的用法示例。
在下文中一共展示了TextDiagnosticBuffer::err_begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckResults
/// CheckResults - This compares the expected results to those that
/// were actually reported. It emits any discrepencies. Return "true" if there
/// were problems. Return "false" otherwise.
static unsigned CheckResults(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
const TextDiagnosticBuffer &Buffer,
ExpectedData &ED) {
// We want to capture the delta between what was expected and what was
// seen.
//
// Expected \ Seen - set expected but not seen
// Seen \ Expected - set seen but not expected
unsigned NumProblems = 0;
const DiagnosticLevelMask DiagMask =
Diags.getDiagnosticOptions().getVerifyIgnoreUnexpected();
// See if there are error mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "error", ED.Errors,
Buffer.err_begin(), Buffer.err_end(),
bool(DiagnosticLevelMask::Error & DiagMask));
// See if there are warning mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "warning", ED.Warnings,
Buffer.warn_begin(), Buffer.warn_end(),
bool(DiagnosticLevelMask::Warning & DiagMask));
// See if there are remark mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "remark", ED.Remarks,
Buffer.remark_begin(), Buffer.remark_end(),
bool(DiagnosticLevelMask::Remark & DiagMask));
// See if there are note mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "note", ED.Notes,
Buffer.note_begin(), Buffer.note_end(),
bool(DiagnosticLevelMask::Note & DiagMask));
return NumProblems;
}
示例2: CheckResults
/// This compares the expected results to those that were actually reported.
/// It emits any discrepencies. Return "true" if there were problems. Return
/// "false" otherwise.
static unsigned CheckResults(DiagnosticsEngine &Diags,
llvm::SourceMgr &SourceMgr,
const TextDiagnosticBuffer &Buffer,
ExpectedData &ED) {
// We want to capture the delta between what was expected and what was
// seen.
//
// Expected \ Seen - set expected but not seen
// Seen \ Expected - set seen but not expected
unsigned NumProblems = 0;
// See if there are error mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "error", ED.Errors,
Buffer.err_begin(), Buffer.err_end());
// See if there are note mismatches.
NumProblems += CheckLists(Diags, SourceMgr, "note", ED.Notes,
Buffer.note_begin(), Buffer.note_end());
return NumProblems;
}
示例3: clang_getRemappingsFromFileList
CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
unsigned numFiles) {
bool Logging = ::getenv("LIBCLANG_LOGGING");
std::unique_ptr<Remap> remap(new Remap());
if (numFiles == 0) {
if (Logging)
llvm::errs() << "clang_getRemappingsFromFileList was called with "
"numFiles=0\n";
return remap.release();
}
if (!filePaths) {
if (Logging)
llvm::errs() << "clang_getRemappingsFromFileList was called with "
"NULL filePaths\n";
return 0;
}
TextDiagnosticBuffer diagBuffer;
SmallVector<StringRef, 32> Files;
for (unsigned i = 0; i != numFiles; ++i)
Files.push_back(filePaths[i]);
bool err = arcmt::getFileRemappingsFromFileList(remap->Vec, Files,
&diagBuffer);
if (err) {
if (Logging) {
llvm::errs() << "Error by clang_getRemappingsFromFileList\n";
for (TextDiagnosticBuffer::const_iterator
I = diagBuffer.err_begin(), E = diagBuffer.err_end(); I != E; ++I)
llvm::errs() << I->second << '\n';
}
return remap.release();
}
return remap.release();
}
示例4: clang_getRemappings
CXRemapping clang_getRemappings(const char *migrate_dir_path) {
bool Logging = ::getenv("LIBCLANG_LOGGING");
if (!migrate_dir_path) {
if (Logging)
llvm::errs() << "clang_getRemappings was called with NULL parameter\n";
return 0;
}
bool exists = false;
llvm::sys::fs::exists(migrate_dir_path, exists);
if (!exists) {
if (Logging) {
llvm::errs() << "Error by clang_getRemappings(\"" << migrate_dir_path
<< "\")\n";
llvm::errs() << "\"" << migrate_dir_path << "\" does not exist\n";
}
return 0;
}
TextDiagnosticBuffer diagBuffer;
llvm::OwningPtr<Remap> remap(new Remap());
bool err = arcmt::getFileRemappings(remap->Vec, migrate_dir_path,&diagBuffer);
if (err) {
if (Logging) {
llvm::errs() << "Error by clang_getRemappings(\"" << migrate_dir_path
<< "\")\n";
for (TextDiagnosticBuffer::const_iterator
I = diagBuffer.err_begin(), E = diagBuffer.err_end(); I != E; ++I)
llvm::errs() << I->second << '\n';
}
return 0;
}
return remap.take();
}