sylvestre.ledru added inline comments.
================ Comment at: tools/clang-format/ClangFormat.cpp:377 break; case 1: Error = clang::format::format(FileNames[0]); ---------------- djasper wrote: > I think we should restructure the code to not have to duplicate what you are > adding here. I think fundamentally, we should be able to change this to: > > if (FileNames.empty()) { > Error = clang::format::format("-"); > return Error ? 1 : 0; > } > if (FileNames.size() == 1 && (!Offsets.empty() || !Lengths.empty() || > !LineRanges.empty())) { > errs() << "error: -offset .... " > return 1; > } > for (const auto& FileName : FileNames) { > if (Verbose.getNumOccurences() != 0) > errs() << "Formatting " << Filename << "\n"; > Error |= clang::format::format(FileName); > } > return Error ? 1 : 0; This isn't correct. You can have ``` bin/clang-format -lines=1:1 foo-1.cpp foo-2.cpp ``` we won't enter into the "error: -offset" error https://reviews.llvm.org/D34824 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits