/// 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; }
/// 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; }
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(); }
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(); }