[clang-tidy] Fix ClangTidyTest to initialize context before checks.
[clang-tidy] Fix ClangTidyTest to initialize context before checks.

Summary:
Currently, `clang::tidy::test::runCheckOnCode()` constructs the check
instances *before* initializing the ClangTidyContext. This ordering causes
problems when the check's constructor accesses the context, for example, through
`getLangOpts()`.

This revision moves the construction to after the context initialization, which
follows the pattern used in the clang tidy tool itself.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

git-svn-id: a34e9779ed74578ad5922b3306b3d80a0c825546@364435 91177308-0d34-0410-b5e6-96231b3b80d8

llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra,llvm-mirror/clang-tools-extra