本文整理汇总了C++中ASTUnit::stored_diag_end方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTUnit::stored_diag_end方法的具体用法?C++ ASTUnit::stored_diag_end怎么用?C++ ASTUnit::stored_diag_end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTUnit
的用法示例。
在下文中一共展示了ASTUnit::stored_diag_end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Renderer
CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU,
bool checkIfChanged) {
ASTUnit *AU = static_cast<ASTUnit *>(TU->TUData);
if (TU->Diagnostics && checkIfChanged) {
// In normal use, ASTUnit's diagnostics should not change unless we reparse.
// Currently they can only change by using the internal testing flag
// '-error-on-deserialized-decl' which will error during deserialization of
// a declaration. What will happen is:
//
// -c-index-test gets a CXTranslationUnit
// -checks the diagnostics, the diagnostics set is lazily created,
// no errors are reported
// -later does an operation, like annotation of tokens, that triggers
// -error-on-deserialized-decl, that will emit a diagnostic error,
// that ASTUnit will catch and add to its stored diagnostics vector.
// -c-index-test wants to check whether an error occurred after performing
// the operation but can only query the lazily created set.
//
// We check here if a new diagnostic was appended since the last time the
// diagnostic set was created, in which case we reset it.
CXDiagnosticSetImpl *
Set = static_cast<CXDiagnosticSetImpl*>(TU->Diagnostics);
if (AU->stored_diag_size() != Set->getNumDiagnostics()) {
// Diagnostics in the ASTUnit were updated, reset the associated
// diagnostics.
delete Set;
TU->Diagnostics = 0;
}
}
if (!TU->Diagnostics) {
CXDiagnosticSetImpl *Set = new CXDiagnosticSetImpl();
TU->Diagnostics = Set;
DiagnosticOptions DOpts;
CXDiagnosticRenderer Renderer(AU->getSourceManager(),
AU->getASTContext().getLangOpts(),
DOpts, Set);
for (ASTUnit::stored_diag_iterator it = AU->stored_diag_begin(),
ei = AU->stored_diag_end(); it != ei; ++it) {
Renderer.emitStoredDiagnostic(*it);
}
}
return static_cast<CXDiagnosticSetImpl*>(TU->Diagnostics);
}