[llvm-branch-commits] [clang] d126943 - Index: Remove unused internal header SimpleFormatContext.h, NFC

Duncan P. N. Exon Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 4 15:16:03 PST 2020


Author: Duncan P. N. Exon Smith
Date: 2020-12-04T15:10:27-08:00
New Revision: d126943251d0cd77e572bced5ab6c23595acd468

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

LOG: Index: Remove unused internal header SimpleFormatContext.h, NFC

Looks like nothing has included this header since
d21485d2f5ffacf7b726c741ee409b3682045255 / r286279 in 2016. Delete the
dead code.

Added: 
    

Modified: 
    clang/lib/Index/CMakeLists.txt
    llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn

Removed: 
    clang/lib/Index/SimpleFormatContext.h


################################################################################
diff  --git a/clang/lib/Index/CMakeLists.txt b/clang/lib/Index/CMakeLists.txt
index 68ebb5b7ede3..68c689b01969 100644
--- a/clang/lib/Index/CMakeLists.txt
+++ b/clang/lib/Index/CMakeLists.txt
@@ -16,7 +16,6 @@ add_clang_library(clangIndex
 
   ADDITIONAL_HEADERS
   IndexingContext.h
-  SimpleFormatContext.h
 
   LINK_LIBS
   clangAST

diff  --git a/clang/lib/Index/SimpleFormatContext.h b/clang/lib/Index/SimpleFormatContext.h
deleted file mode 100644
index 17793154a3ae..000000000000
--- a/clang/lib/Index/SimpleFormatContext.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//===--- SimpleFormatContext.h ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-/// \file
-///
-/// Defines a utility class for use of clang-format in libclang
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_LIB_INDEX_SIMPLEFORMATCONTEXT_H
-#define LLVM_CLANG_LIB_INDEX_SIMPLEFORMATCONTEXT_H
-
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/DiagnosticOptions.h"
-#include "clang/Basic/FileManager.h"
-#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Rewrite/Core/Rewriter.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/raw_ostream.h"
-
-namespace clang {
-namespace index {
-
-/// A small class to be used by libclang clients to format
-/// a declaration string in memory. This object is instantiated once
-/// and used each time a formatting is needed.
-class SimpleFormatContext {
-public:
-  SimpleFormatContext(LangOptions Options)
-      : DiagOpts(new DiagnosticOptions()),
-        Diagnostics(new DiagnosticsEngine(new DiagnosticIDs, DiagOpts.get())),
-        InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem),
-        Files(FileSystemOptions(), InMemoryFileSystem),
-        Sources(*Diagnostics, Files), Rewrite(Sources, Options) {
-    Diagnostics->setClient(new IgnoringDiagConsumer, true);
-  }
-
-  FileID createInMemoryFile(StringRef Name, StringRef Content) {
-    InMemoryFileSystem->addFile(Name, 0,
-                                llvm::MemoryBuffer::getMemBuffer(Content));
-    const FileEntry *Entry = Files.getFile(Name);
-    assert(Entry != nullptr);
-    return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);
-  }
-
-  std::string getRewrittenText(FileID ID) {
-    std::string Result;
-    llvm::raw_string_ostream OS(Result);
-    Rewrite.getEditBuffer(ID).write(OS);
-    OS.flush();
-    return Result;
-  }
-
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
-  IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
-  IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem;
-  FileManager Files;
-  SourceManager Sources;
-  Rewriter Rewrite;
-};
-
-} // end namespace index
-} // end namespace clang
-
-#endif

diff  --git a/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
index ef15a55ff9d3..942b4047b8b5 100644
--- a/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
@@ -22,7 +22,6 @@ static_library("Index") {
     "IndexingAction.cpp",
     "IndexingContext.cpp",
     "IndexingContext.h",
-    "SimpleFormatContext.h",
     "USRGeneration.cpp",
   ]
 }


        


More information about the llvm-branch-commits mailing list