本文整理汇总了C++中PathDiagnosticPiece::addFixItHint方法的典型用法代码示例。如果您正苦于以下问题:C++ PathDiagnosticPiece::addFixItHint方法的具体用法?C++ PathDiagnosticPiece::addFixItHint怎么用?C++ PathDiagnosticPiece::addFixItHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathDiagnosticPiece
的用法示例。
在下文中一共展示了PathDiagnosticPiece::addFixItHint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleDiagnostic
void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(DiagLevel, Info);
// Create a PathDiagnostic with a single piece.
PathDiagnostic* D = new PathDiagnostic();
const char *LevelStr;
switch (DiagLevel) {
default:
case Diagnostic::Ignored: assert(0 && "Invalid diagnostic type");
case Diagnostic::Note: LevelStr = "note: "; break;
case Diagnostic::Warning: LevelStr = "warning: "; break;
case Diagnostic::Error: LevelStr = "error: "; break;
case Diagnostic::Fatal: LevelStr = "fatal error: "; break;
}
llvm::SmallString<100> StrC;
StrC += LevelStr;
Info.FormatDiagnostic(StrC);
PathDiagnosticPiece *P =
new PathDiagnosticEventPiece(FullSourceLoc(Info.getLocation(),
Info.getSourceManager()),
StrC.str());
for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i)
P->addRange(Info.getRange(i).getAsRange());
for (unsigned i = 0, e = Info.getNumFixItHints(); i != e; ++i)
P->addFixItHint(Info.getFixItHint(i));
D->push_front(P);
HandlePathDiagnostic(D);
}