本文整理汇总了C++中DiagnosticsEngine::getCustomDiagID方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagnosticsEngine::getCustomDiagID方法的具体用法?C++ DiagnosticsEngine::getCustomDiagID怎么用?C++ DiagnosticsEngine::getCustomDiagID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagnosticsEngine
的用法示例。
在下文中一共展示了DiagnosticsEngine::getCustomDiagID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FlushDiagnostics
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
SmallVector<char, 64> Buf;
// FIXME: Flush the diagnostics in order.
for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error,
escapeDiag(it->second, Buf)));
for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Warning,
escapeDiag(it->second, Buf)));
for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Note,
escapeDiag(it->second, Buf)));
}
示例2: FlushDiagnostics
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
// FIXME: Flush the diagnostics in order.
for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Error, "%0"))
<< it->second;
for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Warning, "%0"))
<< it->second;
for (const_iterator it = remark_begin(), ie = remark_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Remark, "%0"))
<< it->second;
for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
Diags.Report(Diags.getCustomDiagID(DiagnosticsEngine::Note, "%0"))
<< it->second;
}
示例3: EmitBackendOutput
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
const CodeGenOptions &CGOpts,
const clang::TargetOptions &TOpts,
const LangOptions &LOpts, const llvm::DataLayout &TDesc,
Module *M, BackendAction Action,
std::unique_ptr<raw_pwrite_stream> OS) {
if (!CGOpts.ThinLTOIndexFile.empty()) {
runThinLTOBackend(CGOpts, M, std::move(OS));
return;
}
EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M);
AsmHelper.EmitAssembly(Action, std::move(OS));
// Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
// DataLayout.
if (AsmHelper.TM) {
std::string DLDesc = M->getDataLayout().getStringRepresentation();
if (DLDesc != TDesc.getStringRepresentation()) {
unsigned DiagID = Diags.getCustomDiagID(
DiagnosticsEngine::Error, "backend data layout '%0' does not match "
"expected target description '%1'");
Diags.Report(DiagID) << DLDesc << TDesc.getStringRepresentation();
}
}
}
示例4: EmitBackendOutput
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
const HeaderSearchOptions &HeaderOpts,
const CodeGenOptions &CGOpts,
const clang::TargetOptions &TOpts,
const LangOptions &LOpts,
const llvm::DataLayout &TDesc, Module *M,
BackendAction Action,
std::unique_ptr<raw_pwrite_stream> OS) {
if (!CGOpts.ThinLTOIndexFile.empty()) {
// If we are performing a ThinLTO importing compile, load the function index
// into memory and pass it into runThinLTOBackend, which will run the
// function importer and invoke LTO passes.
Expected<std::unique_ptr<ModuleSummaryIndex>> IndexOrErr =
llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile,
/*IgnoreEmptyThinLTOIndexFile*/true);
if (!IndexOrErr) {
logAllUnhandledErrors(IndexOrErr.takeError(), errs(),
"Error loading index file '" +
CGOpts.ThinLTOIndexFile + "': ");
return;
}
std::unique_ptr<ModuleSummaryIndex> CombinedIndex = std::move(*IndexOrErr);
// A null CombinedIndex means we should skip ThinLTO compilation
// (LLVM will optionally ignore empty index files, returning null instead
// of an error).
bool DoThinLTOBackend = CombinedIndex != nullptr;
if (DoThinLTOBackend) {
runThinLTOBackend(CombinedIndex.get(), M, HeaderOpts, CGOpts, TOpts,
LOpts, std::move(OS), CGOpts.SampleProfileFile, Action);
return;
}
}
EmitAssemblyHelper AsmHelper(Diags, HeaderOpts, CGOpts, TOpts, LOpts, M);
if (CGOpts.ExperimentalNewPassManager)
AsmHelper.EmitAssemblyWithNewPassManager(Action, std::move(OS));
else
AsmHelper.EmitAssembly(Action, std::move(OS));
// Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
// DataLayout.
if (AsmHelper.TM) {
std::string DLDesc = M->getDataLayout().getStringRepresentation();
if (DLDesc != TDesc.getStringRepresentation()) {
unsigned DiagID = Diags.getCustomDiagID(
DiagnosticsEngine::Error, "backend data layout '%0' does not match "
"expected target description '%1'");
Diags.Report(DiagID) << DLDesc << TDesc.getStringRepresentation();
}
}
}
示例5: areAllSgConnected
bool HtTpg::areAllSgConnected(DiagnosticsEngine &diag)
{
// fill in connections where possible
bool bProgress;
do {
bProgress = false;
for (size_t i = 0; i < m_sgNameList.size(); i += 1) {
for (size_t j = 0; j < m_sgNameList.size(); j += 1) {
if (getUrsDelta(i, j) != RS_DELTA_UNKNOWN)
continue;
for (size_t k = 0; k < m_sgNameList.size(); k += 1) {
if (getUrsDelta(i, k) == RS_DELTA_UNKNOWN || getUrsDelta(k, j) == RS_DELTA_UNKNOWN)
continue;
int delta = getUrsDelta(i, k) + getUrsDelta(k, j);
setUrsDelta(i, j, delta);
setUrsDelta(j, i, -delta);
bProgress = true;
break;
}
}
}
} while (bProgress);
// now check connectivity
bool bFullyConnected = true;
for (size_t i = 0; i < m_sgNameList.size(); i += 1) {
for (size_t j = 0; j < i; j += 1) {
if (m_pSgUrsMatrix[j * m_sgNameList.size() + i] == RS_DELTA_UNKNOWN) {
bFullyConnected = false;
char errorMsg[256];
sprintf(errorMsg, "subgroups of timing path group '%s' are not fully connected (%s and %s)",
m_name.c_str(), m_sgNameList[j].c_str(), m_sgNameList[i].c_str());
unsigned DiagID = diag.getCustomDiagID(DiagnosticsEngine::Error, errorMsg);
diag.Report(DiagID);
}
}
}
return bFullyConnected;
}
示例6: EmitBackendOutput
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
const CodeGenOptions &CGOpts,
const clang::TargetOptions &TOpts,
const LangOptions &LOpts, StringRef TDesc,
Module *M, BackendAction Action,
raw_pwrite_stream *OS) {
EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M);
AsmHelper.EmitAssembly(Action, OS);
// If an optional clang TargetInfo description string was passed in, use it to
// verify the LLVM TargetMachine's DataLayout.
if (AsmHelper.TM && !TDesc.empty()) {
std::string DLDesc = M->getDataLayout().getStringRepresentation();
if (DLDesc != TDesc) {
unsigned DiagID = Diags.getCustomDiagID(
DiagnosticsEngine::Error, "backend data layout '%0' does not match "
"expected target description '%1'");
Diags.Report(DiagID) << DLDesc << TDesc;
}
}
}
示例7: FlushDiagnostics
void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
for (const auto &I : All) {
auto Diag = Diags.Report(Diags.getCustomDiagID(I.first, "%0"));
switch (I.first) {
default: llvm_unreachable(
"Diagnostic not handled during diagnostic flushing!");
case DiagnosticsEngine::Note:
Diag << Notes[I.second].second;
break;
case DiagnosticsEngine::Warning:
Diag << Warnings[I.second].second;
break;
case DiagnosticsEngine::Remark:
Diag << Remarks[I.second].second;
break;
case DiagnosticsEngine::Error:
case DiagnosticsEngine::Fatal:
Diag << Errors[I.second].second;
break;
}
}
}
示例8: PragmaHandler
OMPPragmaHandler::OMPPragmaHandler(PragmaDirectiveMap &Directives,
DiagnosticsEngine &Diags)
: PragmaHandler("omp"),
Directives(Directives),
Diags(Diags),
DiagUnrecognisedIdentifier(0),
DiagFoundPragmaStmt(0),
DiagUnsupportedConstruct(0),
DiagMalformedStatement(0),
DiagUnknownClause(0),
DiagUnknownDirective(0) {
DiagUnrecognisedIdentifier =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Unrecognised identifier");
DiagFoundPragmaStmt =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Found pragma statement");
DiagUnsupportedConstruct =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Unsupported construct");
DiagMalformedStatement =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Malformed statement");
DiagUnknownClause =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Unknown clause");
DiagUnknownDirective =
Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"Pragma Handler: Unknown directive");
}
示例9: report
bool FileRemapper::report(const Twine &err, DiagnosticsEngine &Diag) {
Diag.Report(Diag.getCustomDiagID(DiagnosticsEngine::Error, "%0"))
<< err.str();
return true;
}