sylvestre.ledru updated this revision to Diff 104995. Herald added a subscriber: klimek.
https://reviews.llvm.org/D34824 Files: docs/ClangFormat.rst docs/ReleaseNotes.rst test/Format/verbose.cpp tools/clang-format/ClangFormat.cpp Index: tools/clang-format/ClangFormat.cpp =================================================================== --- tools/clang-format/ClangFormat.cpp +++ tools/clang-format/ClangFormat.cpp @@ -102,6 +102,11 @@ "SortIncludes style flag"), cl::cat(ClangFormatCategory)); +static cl::opt<bool> Verbose( + "verbose", + cl::desc("If set, shows the list of processed files"), + cl::cat(ClangFormatCategory)); + static cl::list<std::string> FileNames(cl::Positional, cl::desc("[<file> ...]"), cl::cat(ClangFormatCategory)); @@ -371,6 +376,8 @@ break; case 1: Error = clang::format::format(FileNames[0]); + if (Verbose.getNumOccurrences() != 0) + errs() << "Formatting " << FileNames[0] << '\n'; break; default: if (!Offsets.empty() || !Lengths.empty() || !LineRanges.empty()) { @@ -378,8 +385,11 @@ "single file.\n"; return 1; } - for (unsigned i = 0; i < FileNames.size(); ++i) + for (unsigned i = 0; i < FileNames.size(); ++i) { Error |= clang::format::format(FileNames[i]); + if (Verbose.getNumOccurrences() != 0) + errs() << "Formatting " << FileNames[i] << '\n'; + } break; } return Error ? 1 : 0; Index: test/Format/verbose.cpp =================================================================== --- test/Format/verbose.cpp +++ test/Format/verbose.cpp @@ -0,0 +1,5 @@ +// RUN: clang-format %s -verbose | FileCheck %s +// CHECK: Formatting + +int a; + Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -176,6 +176,9 @@ * Comment reflow support added. Overly long comment lines will now be reflown with the rest of the paragraph instead of just broken. Option **ReflowComments** added and enabled by default. +* Option -verbose added to the command line. + Shows the list of processed files. + libclang -------- Index: docs/ClangFormat.rst =================================================================== --- docs/ClangFormat.rst +++ docs/ClangFormat.rst @@ -71,6 +71,7 @@ Use -style="{key: value, ...}" to set specific parameters, e.g.: -style="{BasedOnStyle: llvm, IndentWidth: 8}" + -verbose - If set, shows the list of processed files Generic Options:
Index: tools/clang-format/ClangFormat.cpp =================================================================== --- tools/clang-format/ClangFormat.cpp +++ tools/clang-format/ClangFormat.cpp @@ -102,6 +102,11 @@ "SortIncludes style flag"), cl::cat(ClangFormatCategory)); +static cl::opt<bool> Verbose( + "verbose", + cl::desc("If set, shows the list of processed files"), + cl::cat(ClangFormatCategory)); + static cl::list<std::string> FileNames(cl::Positional, cl::desc("[<file> ...]"), cl::cat(ClangFormatCategory)); @@ -371,6 +376,8 @@ break; case 1: Error = clang::format::format(FileNames[0]); + if (Verbose.getNumOccurrences() != 0) + errs() << "Formatting " << FileNames[0] << '\n'; break; default: if (!Offsets.empty() || !Lengths.empty() || !LineRanges.empty()) { @@ -378,8 +385,11 @@ "single file.\n"; return 1; } - for (unsigned i = 0; i < FileNames.size(); ++i) + for (unsigned i = 0; i < FileNames.size(); ++i) { Error |= clang::format::format(FileNames[i]); + if (Verbose.getNumOccurrences() != 0) + errs() << "Formatting " << FileNames[i] << '\n'; + } break; } return Error ? 1 : 0; Index: test/Format/verbose.cpp =================================================================== --- test/Format/verbose.cpp +++ test/Format/verbose.cpp @@ -0,0 +1,5 @@ +// RUN: clang-format %s -verbose | FileCheck %s +// CHECK: Formatting + +int a; + Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -176,6 +176,9 @@ * Comment reflow support added. Overly long comment lines will now be reflown with the rest of the paragraph instead of just broken. Option **ReflowComments** added and enabled by default. +* Option -verbose added to the command line. + Shows the list of processed files. + libclang -------- Index: docs/ClangFormat.rst =================================================================== --- docs/ClangFormat.rst +++ docs/ClangFormat.rst @@ -71,6 +71,7 @@ Use -style="{key: value, ...}" to set specific parameters, e.g.: -style="{BasedOnStyle: llvm, IndentWidth: 8}" + -verbose - If set, shows the list of processed files Generic Options:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits