Example #1
0
	void ExitIfError(clang::ASTContext &Context)
	{
		DiagnosticsEngine & diags = Context.getDiagnostics();
		if (diags.hasErrorOccurred()) {
			unsigned DiagID = diags.getCustomDiagID(DiagnosticsEngine::Fatal,
				"previous errors prevent further compilation");
			diags.Report(DiagID);
			exit(1);
		}
	}
void ReplaceArrayAccessWithIndex::HandleTranslationUnit(clang::ASTContext &Ctx)
{
  TransAssert(Collector && "NULL Collector");
  Collector->TraverseDecl(Ctx.getTranslationUnitDecl());

  if (QueryInstanceOnly)
    return;

  if (TransformationCounter > ValidInstanceNum) {
    TransError = TransMaxInstanceError;
    return;
  }

  Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
  doRewrite();

  if (Ctx.getDiagnostics().hasErrorOccurred() ||
      Ctx.getDiagnostics().hasFatalErrorOccurred())
    TransError = TransInternalError;
}
bool WebCLConsumer::hasErrors(clang::ASTContext &context) const
{
    clang::DiagnosticsEngine &diags = context.getDiagnostics();
    return diags.hasErrorOccurred() || diags.hasUnrecoverableErrorOccurred();
}
Example #4
0
 virtual void HandleTranslationUnit (clang::ASTContext &Context) override
 {
   assert(0 == Context.getDiagnostics().hasFatalErrorOccurred());
   _visitor.TraverseDecl(Context.getTranslationUnitDecl());
 }