[PATCH] Config file support for clang-format, part 2.

Alexander Kornienko alexfh at google.com
Fri May 10 04:55:37 PDT 2013


  Now I have an answer about reasons to ignore errors from is_regular_file ;)

  It should be enough to know that we can't read the file. In particular, we don't want "No such file or directory" to be treated as an error:
    Error quering /.../work/llvm/tools/clang/.clang-format: No such file or directory
    Error quering /.../work/llvm/tools/.clang-format: No such file or directory
    YAML:1:1: error: not a mapping
    akljsdflj
    ^~~~~~~~~
    Error reading /.../work/llvm/.clang-format: Invalid argument
    Error quering /.../work/.clang-format: No such file or directory
    Error quering /.../.clang-format: No such file or directory
    ...
    Error quering /.clang-format: No such file or directory
    Can't find usable .clang-format, using LLVM style

  So I removed error handling again, now output for a file with invalid contents looks better:
    YAML:1:1: error: not a mapping
    akljsdflj
    ^~~~~~~~~
    Error reading /.../work/llvm/.clang-format: Invalid argument
    Can't find usable .clang-format, using LLVM style

Hi klimek, djasper,

http://llvm-reviews.chandlerc.com/D758

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D758?vs=1916&id=1918#toc

BRANCH
  svn

ARCANIST PROJECT
  clang

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  tools/clang-format/ClangFormat.cpp
  unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D758.4.patch
Type: text/x-patch
Size: 9867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130510/2fd207fb/attachment.bin>


More information about the cfe-commits mailing list