Author: owenca Date: 2022-04-12T16:05:39-07:00 New Revision: 0cde8bdb0bd0d2e681be43e8a4057138048eb421
URL: https://github.com/llvm/llvm-project/commit/0cde8bdb0bd0d2e681be43e8a4057138048eb421 DIFF: https://github.com/llvm/llvm-project/commit/0cde8bdb0bd0d2e681be43e8a4057138048eb421.diff LOG: Revert "[clang-format] Allow empty .clang-format file" This reverts commit 4e814a6f2db90046914734fac4f9e3110c7e0424. Added: Modified: clang/lib/Format/Format.cpp clang/test/Format/style-on-command-line.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index bce66d117dbd1..0bbd54353d7b8 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1722,7 +1722,7 @@ std::error_code parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle::LanguageKind Language = Style->Language; assert(Language != FormatStyle::LK_None); if (Config.getBuffer().trim().empty()) - return make_error_code(ParseError::Success); + return make_error_code(ParseError::Error); Style->StyleSet.Clear(); std::vector<FormatStyle> Styles; llvm::yaml::Input Input(Config, /*Ctxt=*/nullptr, DiagHandler, diff --git a/clang/test/Format/style-on-command-line.cpp b/clang/test/Format/style-on-command-line.cpp index 7d5c7f4cbe562..3fd89f587dc6f 100644 --- a/clang/test/Format/style-on-command-line.cpp +++ b/clang/test/Format/style-on-command-line.cpp @@ -6,7 +6,7 @@ // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %t/.clang-format // RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s // RUN: printf "\n" > %t/.clang-format -// RUN: clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s +// RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s // RUN: rm %t/.clang-format // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %t/_clang-format // RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits