From fa63e9831ef286f9ea2a7903b2541400a572fdf4 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Thu, 2 Aug 2018 10:30:56 +0000 Subject: [PATCH] Replace hardcoded format styles in a few tools with the default style in libFormat. llvm-svn: 338696 --- clang-tools-extra/change-namespace/ChangeNamespace.cpp | 3 ++- .../tool/ClangApplyReplacementsMain.cpp | 4 ++-- clang-tools-extra/clang-move/ClangMove.cpp | 3 ++- clang-tools-extra/include-fixer/tool/ClangIncludeFixer.cpp | 6 ++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/clang-tools-extra/change-namespace/ChangeNamespace.cpp b/clang-tools-extra/change-namespace/ChangeNamespace.cpp index 35c321aed797..378ffe1f9556 100644 --- a/clang-tools-extra/change-namespace/ChangeNamespace.cpp +++ b/clang-tools-extra/change-namespace/ChangeNamespace.cpp @@ -989,7 +989,8 @@ void ChangeNamespaceTool::onEndOfTranslationUnit() { // Add replacements referring to the changed code to existing replacements, // which refers to the original code. Replaces = Replaces.merge(NewReplacements); - auto Style = format::getStyle("file", FilePath, FallbackStyle); + auto Style = + format::getStyle(format::DefaultFormatStyle, FilePath, FallbackStyle); if (!Style) { llvm::errs() << llvm::toString(Style.takeError()) << "\n"; continue; diff --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp index 24a430f0dbbc..8977b1315294 100644 --- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp +++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp @@ -97,8 +97,8 @@ int main(int argc, char **argv) { IntrusiveRefCntPtr(new DiagnosticIDs()), DiagOpts.get()); // Determine a formatting style from options. - auto FormatStyleOrError = - format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM"); + auto FormatStyleOrError = format::getStyle(FormatStyleOpt, FormatStyleConfig, + format::DefaultFallbackStyle); if (!FormatStyleOrError) { llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n"; return 1; diff --git a/clang-tools-extra/clang-move/ClangMove.cpp b/clang-tools-extra/clang-move/ClangMove.cpp index e126852e3820..b7a9363dc44a 100644 --- a/clang-tools-extra/clang-move/ClangMove.cpp +++ b/clang-tools-extra/clang-move/ClangMove.cpp @@ -795,7 +795,8 @@ void ClangMoveTool::removeDeclsInOldFiles() { // Ignore replacements for new.h/cc. if (SI == FilePathToFileID.end()) continue; llvm::StringRef Code = SM.getBufferData(SI->second); - auto Style = format::getStyle("file", FilePath, Context->FallbackStyle); + auto Style = format::getStyle(format::DefaultFormatStyle, FilePath, + Context->FallbackStyle); if (!Style) { llvm::errs() << llvm::toString(Style.takeError()) << "\n"; continue; diff --git a/clang-tools-extra/include-fixer/tool/ClangIncludeFixer.cpp b/clang-tools-extra/include-fixer/tool/ClangIncludeFixer.cpp index 2f2e45eaab6f..d9d97d2385ad 100644 --- a/clang-tools-extra/include-fixer/tool/ClangIncludeFixer.cpp +++ b/clang-tools-extra/include-fixer/tool/ClangIncludeFixer.cpp @@ -324,7 +324,8 @@ int includeFixerMain(int argc, const char **argv) { const IncludeFixerContext::HeaderInfo &RHS) { return LHS.QualifiedName == RHS.QualifiedName; }); - auto InsertStyle = format::getStyle("file", Context.getFilePath(), Style); + auto InsertStyle = format::getStyle(format::DefaultFormatStyle, + Context.getFilePath(), Style); if (!InsertStyle) { llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n"; return 1; @@ -402,7 +403,8 @@ int includeFixerMain(int argc, const char **argv) { std::vector FixerReplacements; for (const auto &Context : Contexts) { StringRef FilePath = Context.getFilePath(); - auto InsertStyle = format::getStyle("file", FilePath, Style); + auto InsertStyle = + format::getStyle(format::DefaultFormatStyle, FilePath, Style); if (!InsertStyle) { llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n"; return 1;