[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest
authorHaojian Wu <hokein@google.com>
Thu, 26 Oct 2017 08:37:25 +0000 (08:37 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 26 Oct 2017 08:37:25 +0000 (08:37 +0000)
commitd2825825f8cd8b692d42075dfbc9f8195765e278
treecb91166cdc23e75c69ca0127dd80b919fedd6aa9
parentcaceb64067aefcf709fb55265832bda46a2d1c2a
[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest

Summary:
This is part 2 of 3 of a series of changes to improve
Objective-C linting in clang-tidy.

Currently, `clang::tidy::test::runCheckOnCode()` assumes all files
are C++ and unconditionally adds `-std=c++11` to the list of
`clang-tidy` options.

This updates the logic to check the extension of the source file
and only add `-std=c++11` if the extension indicates C++ or
Objective-C++.

Depends On D39188

Test Plan:

  ninja ClangTidyTests && \
  ./tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: Wizard

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

llvm-svn: 316645
clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h