[clang-tools-extra] r244722 - Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 00:57:17 PDT 2015


Author: klimek
Date: Wed Aug 12 02:57:16 2015
New Revision: 244722

URL: http://llvm.org/viewvc/llvm-project?rev=244722&view=rev
Log:
Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.

Modified:
    clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h

Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h?rev=244722&r1=244721&r2=244722&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h Wed Aug 12 02:57:16 2015
@@ -76,8 +76,13 @@ runCheckOnCode(StringRef Code, std::vect
                               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;




More information about the cfe-commits mailing list