diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp index 5ae95781fb..ea9482ea12 100644 --- a/tools/clang-format/ClangFormat.cpp +++ b/tools/clang-format/ClangFormat.cpp @@ -29,10 +29,10 @@ using namespace llvm; static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden); static cl::list -Offsets("offset", cl::desc("Format a range starting at this file offset. Can " +Offsets("offset", cl::desc("Format a range starting at this byte offset. Can " "only be used with one input file.")); static cl::list -Lengths("length", cl::desc("Format a range of this length. " +Lengths("length", cl::desc("Format a range of this length (in bytes). " "When it's not specified, end of file is used. " "Can only be used with one input file.")); static cl::opt Style( @@ -80,6 +80,8 @@ FormatStyle getStyle(StringRef StyleName, StringRef FileName) { llvm::sys::path::append(ConfigFile, ".clang-format"); DEBUG(llvm::dbgs() << "Trying " << ConfigFile << "...\n"); bool IsFile = false; + // Ignore errors from is_regular_file: we only need to know if we can read + // the file or not. llvm::sys::fs::is_regular_file(Twine(ConfigFile), IsFile); if (IsFile) { OwningPtr Text;