本文整理汇总了C++中StoredDiagnostic::getRanges方法的典型用法代码示例。如果您正苦于以下问题:C++ StoredDiagnostic::getRanges方法的具体用法?C++ StoredDiagnostic::getRanges怎么用?C++ StoredDiagnostic::getRanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoredDiagnostic
的用法示例。
在下文中一共展示了StoredDiagnostic::getRanges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitStoredDiagnostic
void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) {
emitDiagnostic(Diag.getLocation(), Diag.getLevel(), Diag.getMessage(),
Diag.getRanges(), Diag.getFixIts(),
Diag.getLocation().isValid() ? &Diag.getLocation().getManager()
: 0,
&Diag);
}
示例2:
ASTUnit::StandaloneDiagnostic
TranslationUnitManager::MakeStandaloneDiagnostic(ASTUnit* tu,
const StoredDiagnostic &InDiag) {
ASTUnit::StandaloneDiagnostic OutDiag;
const LangOptions& LangOpts = tu->getASTContext().getLangOpts();
OutDiag.ID = InDiag.getID();
OutDiag.Level = InDiag.getLevel();
OutDiag.Message = InDiag.getMessage();
OutDiag.LocOffset = 0;
if (InDiag.getLocation().isInvalid())
return OutDiag;
const SourceManager &SM = InDiag.getLocation().getManager();
SourceLocation FileLoc = SM.getFileLoc(InDiag.getLocation());
OutDiag.Filename = SM.getFilename(FileLoc);
if (OutDiag.Filename.empty())
return OutDiag;
OutDiag.LocOffset = SM.getFileOffset(FileLoc);
for (const CharSourceRange &Range : InDiag.getRanges())
OutDiag.Ranges.push_back(makeStandaloneRange(Range, SM, LangOpts));
for (const FixItHint &FixIt : InDiag.getFixIts())
OutDiag.FixIts.push_back(makeStandaloneFixIt(SM, LangOpts, FixIt));
return OutDiag;
}