forked from OSchip/llvm-project
Replace hardcoded format styles in a few tools with the default style in libFormat.
llvm-svn: 338696
This commit is contained in:
parent
149fede165
commit
fa63e9831e
|
@ -989,7 +989,8 @@ void ChangeNamespaceTool::onEndOfTranslationUnit() {
|
||||||
// Add replacements referring to the changed code to existing replacements,
|
// Add replacements referring to the changed code to existing replacements,
|
||||||
// which refers to the original code.
|
// which refers to the original code.
|
||||||
Replaces = Replaces.merge(NewReplacements);
|
Replaces = Replaces.merge(NewReplacements);
|
||||||
auto Style = format::getStyle("file", FilePath, FallbackStyle);
|
auto Style =
|
||||||
|
format::getStyle(format::DefaultFormatStyle, FilePath, FallbackStyle);
|
||||||
if (!Style) {
|
if (!Style) {
|
||||||
llvm::errs() << llvm::toString(Style.takeError()) << "\n";
|
llvm::errs() << llvm::toString(Style.takeError()) << "\n";
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -97,8 +97,8 @@ int main(int argc, char **argv) {
|
||||||
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
|
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
|
||||||
|
|
||||||
// Determine a formatting style from options.
|
// Determine a formatting style from options.
|
||||||
auto FormatStyleOrError =
|
auto FormatStyleOrError = format::getStyle(FormatStyleOpt, FormatStyleConfig,
|
||||||
format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
|
format::DefaultFallbackStyle);
|
||||||
if (!FormatStyleOrError) {
|
if (!FormatStyleOrError) {
|
||||||
llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n";
|
llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -795,7 +795,8 @@ void ClangMoveTool::removeDeclsInOldFiles() {
|
||||||
// Ignore replacements for new.h/cc.
|
// Ignore replacements for new.h/cc.
|
||||||
if (SI == FilePathToFileID.end()) continue;
|
if (SI == FilePathToFileID.end()) continue;
|
||||||
llvm::StringRef Code = SM.getBufferData(SI->second);
|
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) {
|
if (!Style) {
|
||||||
llvm::errs() << llvm::toString(Style.takeError()) << "\n";
|
llvm::errs() << llvm::toString(Style.takeError()) << "\n";
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -324,7 +324,8 @@ int includeFixerMain(int argc, const char **argv) {
|
||||||
const IncludeFixerContext::HeaderInfo &RHS) {
|
const IncludeFixerContext::HeaderInfo &RHS) {
|
||||||
return LHS.QualifiedName == RHS.QualifiedName;
|
return LHS.QualifiedName == RHS.QualifiedName;
|
||||||
});
|
});
|
||||||
auto InsertStyle = format::getStyle("file", Context.getFilePath(), Style);
|
auto InsertStyle = format::getStyle(format::DefaultFormatStyle,
|
||||||
|
Context.getFilePath(), Style);
|
||||||
if (!InsertStyle) {
|
if (!InsertStyle) {
|
||||||
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
|
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -402,7 +403,8 @@ int includeFixerMain(int argc, const char **argv) {
|
||||||
std::vector<tooling::Replacements> FixerReplacements;
|
std::vector<tooling::Replacements> FixerReplacements;
|
||||||
for (const auto &Context : Contexts) {
|
for (const auto &Context : Contexts) {
|
||||||
StringRef FilePath = Context.getFilePath();
|
StringRef FilePath = Context.getFilePath();
|
||||||
auto InsertStyle = format::getStyle("file", FilePath, Style);
|
auto InsertStyle =
|
||||||
|
format::getStyle(format::DefaultFormatStyle, FilePath, Style);
|
||||||
if (!InsertStyle) {
|
if (!InsertStyle) {
|
||||||
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
|
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue