]> granicus.if.org Git - clang/commit
[clang-format] New API guessLanguage()
authorBen Hamilton <benhamilton@google.com>
Wed, 21 Feb 2018 15:54:31 +0000 (15:54 +0000)
committerBen Hamilton <benhamilton@google.com>
Wed, 21 Feb 2018 15:54:31 +0000 (15:54 +0000)
commit457631f4acc9ece8bed55835534f9d8f669c1887
treeefa10f47feb7e5162ebefbb445379a1e3f20f176
parent1e53950cab3d26a9838b8d442d58df70c4ae5b2b
[clang-format] New API guessLanguage()

Summary:
For clients which don't have a filesystem, calling getStyle() doesn't
make much sense (there's no .clang-format files to search for).

In this diff, I hoist out the language-guessing logic from getStyle()
and move it into a new API guessLanguage().

I also added support for guessing the language of files which have no
extension (they could be C++ or ObjC).

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak, krasimir

Subscribers: klimek, cfe-commits, sammccall

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325691 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Format/Format.h
lib/Format/Format.cpp
unittests/Format/FormatTest.cpp