Reinstantiate better diagnostic, this time with a fatal error so we don't add a depen...
authorManuel Klimek <klimek@google.com>
Wed, 12 Aug 2015 07:57:16 +0000 (07:57 +0000)
committerManuel Klimek <klimek@google.com>
Wed, 12 Aug 2015 07:57:16 +0000 (07:57 +0000)
llvm-svn: 244722

clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h

index 642057b..62f45bc 100644 (file)
@@ -76,8 +76,13 @@ runCheckOnCode(StringRef Code, std::vector<ClangTidyError> *Errors = nullptr,
                               FileContent.second);
   }
   Invocation.setDiagnosticConsumer(&DiagConsumer);
-  if (!Invocation.run())
-    return "";
+  if (!Invocation.run()) {
+    std::string ErrorText;
+    for (const auto &Error:Context.getErrors()) {
+      ErrorText += Error.Message.Message + "\n";
+    }
+    llvm::report_fatal_error(ErrorText);
+  }
 
   DiagConsumer.finish();
   tooling::Replacements Fixes;