[PATCH] D43522: [clang-format] New API guessLanguage()

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 12:22:27 PST 2018


benhamilton created this revision.
benhamilton added a reviewer: jolesiak.
Herald added subscribers: cfe-commits, klimek.
benhamilton added a reviewer: krasimir.

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


Repository:
  rC Clang

https://reviews.llvm.org/D43522

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43522.135121.patch
Type: text/x-patch
Size: 3861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180220/e276b241/attachment.bin>


More information about the cfe-commits mailing list