]> granicus.if.org Git - clang/commit
[clang-format] Fix bug where -dump-config failed on ObjC header
authorBen Hamilton <benhamilton@google.com>
Mon, 29 Jan 2018 17:36:43 +0000 (17:36 +0000)
committerBen Hamilton <benhamilton@google.com>
Mon, 29 Jan 2018 17:36:43 +0000 (17:36 +0000)
commite88bf5d2a8d380ab44ec2063417dd725c302697c
tree826facf36cd1a58da439d69fdbfcd496f93f3031
parentf457c2c3dfdb45cd6d1f9cc173e95870f35afa54
[clang-format] Fix bug where -dump-config failed on ObjC header

Summary:
`clang-format -dump-config path/to/file.h` never passed
anything for the Code parameter to clang::format::getStyle().

This meant the logic to guess Objective-C from the contents
of a .h file never worked, because LibFormat didn't have the
code to work with.

With this fix, we now correctly read in the contents of the
file if possible with -dump-config.

I had to update the lit config for test/Format/ because
the default config ignores .h files.

Test Plan: make -j12 check-clang

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak, krasimir

Subscribers: Wizard, klimek, cfe-commits, djasper

Differential Revision: https://reviews.llvm.org/D42395

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323668 91177308-0d34-0410-b5e6-96231b3b80d8
test/Format/dump-config-cxx.h [new file with mode: 0644]
test/Format/dump-config-objc.h [new file with mode: 0644]
test/Format/lit.local.cfg [new file with mode: 0644]
tools/clang-format/ClangFormat.cpp