[clang] 637c77f - Revert "clang-format: Add a consumer to diagnostics engine"

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 07:30:20 PDT 2020


Author: Nico Weber
Date: 2020-10-29T10:29:53-04:00
New Revision: 637c77fda64a9b4c021be9c2f89fe8995613c7ed

URL: https://github.com/llvm/llvm-project/commit/637c77fda64a9b4c021be9c2f89fe8995613c7ed
DIFF: https://github.com/llvm/llvm-project/commit/637c77fda64a9b4c021be9c2f89fe8995613c7ed.diff

LOG: Revert "clang-format: Add a consumer to diagnostics engine"

This reverts commit df00267f1fdb0b098dc42f1caa8a59b29c8e0e5f.
clang-format should not depend on Frontend, see comment on
https://reviews.llvm.org/D90121.

Added: 
    

Modified: 
    clang/tools/clang-format/CMakeLists.txt
    clang/tools/clang-format/ClangFormat.cpp

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-format/CMakeLists.txt b/clang/tools/clang-format/CMakeLists.txt
index 28ac4fb5913e..35ecdb11253c 100644
--- a/clang/tools/clang-format/CMakeLists.txt
+++ b/clang/tools/clang-format/CMakeLists.txt
@@ -7,7 +7,6 @@ add_clang_tool(clang-format
 set(CLANG_FORMAT_LIB_DEPS
   clangBasic
   clangFormat
-  clangFrontend
   clangRewrite
   clangToolingCore
   )

diff  --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index d7b768329bcc..3a7247deab46 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -424,11 +423,9 @@ static bool format(StringRef FileName) {
     IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
         new llvm::vfs::InMemoryFileSystem);
     FileManager Files(FileSystemOptions(), InMemoryFileSystem);
-    IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
-    TextDiagnosticPrinter DiagnosticsConsumer(errs(), &*DiagOpts);
     DiagnosticsEngine Diagnostics(
-        IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts,
-        &DiagnosticsConsumer, false);
+        IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs),
+        new DiagnosticOptions);
     SourceManager Sources(Diagnostics, Files);
     FileID ID = createInMemoryFile(AssumedFileName, Code.get(), Sources, Files,
                                    InMemoryFileSystem.get());


        


More information about the cfe-commits mailing list