[clang-format] New API guessLanguage()

Description

[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

Details

Committed
benhamiltonFeb 21 2018, 7:54 AM
Reviewer
jolesiak
Differential Revision
D43522: [clang-format] New API guessLanguage()
Parents
rL325690: Fix a couple of more tests to not create files in the source tree
Branches
Unknown
Tags
Unknown