Try to make VS 2012 happy after r217155

It was failing with:

C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\llvm\include\llvm/Support/ErrorOr.h(102) : error C3861: 'make_error_code': identifier not found

        C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang-tools-extra\clang-tidy\ClangTidyOptions.cpp(153) : see reference to function template instantiation 'llvm::ErrorOr<T>::ErrorOr<std::errc::errc>(E,void *)' being compiled

        with
        [
            T=clang::tidy::ClangTidyOptions,
            E=std::errc::errc
        ]

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217201 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Add a little python script that can run clang-tidy and apply fixes over an entire codebase.

Ever wanted to fix all the header guards in clang? Now it's easy.
  Make sure clang-tidy is in $PATH and a compilation database is available.
  $ ./run-clang-tidy.py -checks=-*,llvm-header-guard -fix
  ... get coffee (or more CPU cores) ...
  $ svn diff

Some may argue that this is just a glorified xargs -P, but it does a bit more ;)

Differential Revision: http://reviews.llvm.org/D5188

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217368 91177308-0d34-0410-b5e6-96231b3b80d8
Move clang-tools-extra docs 1.5 years into the future.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217369 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Add a couple of paragraphs on run-clang-tidy.py to the docs.

Happy tidying.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217373 91177308-0d34-0410-b5e6-96231b3b80d8
run-clang-tidy: Make clang-tidy path configurable and don't fail as horribly
when it's not around.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217374 91177308-0d34-0410-b5e6-96231b3b80d8
Fixed a typo.


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217377 91177308-0d34-0410-b5e6-96231b3b80d8
clang-apply-replacements: Deduplicate paths with FileManager.

Bucket replacements by FileEntry instead of path. The same file with
different paths is very common, relative #include paths and symlinks can
easily create them. When that occurs we would apply the fix twice.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217440 91177308-0d34-0410-b5e6-96231b3b80d8
clang-apply-replacements: For-rangify.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217442 91177308-0d34-0410-b5e6-96231b3b80d8
Unique_ptrify PPCallbacks ownership. Goes with clang r217474.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217475 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Don't try to fix header guard #endif comments if there are escaped
newlines involved.

Getting that right is just not worth it.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217480 91177308-0d34-0410-b5e6-96231b3b80d8
Unique-ptrify ClangTidyCheckFactories. Add a more convenient alternative to
addCheckFactory: registerCheck.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5288

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217489 91177308-0d34-0410-b5e6-96231b3b80d8
std::function-ize ClangTidyCheckFactories.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5289

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217492 91177308-0d34-0410-b5e6-96231b3b80d8
Moved main() to the clang::tidy namespace, no functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217493 91177308-0d34-0410-b5e6-96231b3b80d8
Implemented clang-tidy-check-specific options.

Summary:
Each check can implement readOptions and storeOptions methods to read
and store custom options. Each check's options are stored in a local namespace
to avoid name collisions and provide some sort of context to the user.

Reviewers: bkramer, klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5296

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217661 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Add a checker for long functions.

As this is very dependent on the code base it has some ways of configuration.
It's possible to pick between 3 modes of operation:

- Line counting: number of lines including whitespace and comments
- Statement counting: number of statements within compoundStmts.
- Branch counter

In addition a threshold can be picked, warnings are only emitted when it is met.
The thresholds can be configured via a .clang-tidy file.

Differential Revision: http://reviews.llvm.org/D4986

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217768 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] When emitting header guard fixes bundle all fix-its into one
warning.

Before we would emit two warnings if the header guard was wrong and the comment
on a trailing #endif also needed fixing.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217890 91177308-0d34-0410-b5e6-96231b3b80d8
Rename unit test argument and add argument comments for clarity.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217947 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Don't emit the same fixit multiple times.

If we had many header files we would attach the fix-it for all files to all
warnings, oops. This is harmless 99.9% of the time but can confuse the rewriter
in some edge cases. Sadly I failed to create a small test case for this.

While there move fix-its instead of copying.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217951 91177308-0d34-0410-b5e6-96231b3b80d8
Make a variable local so it's lifetime becomes more obvious.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@217952 91177308-0d34-0410-b5e6-96231b3b80d8
[clang-tidy] Add a checker that warns on TODO comments without username.

It also suggests a fix-it, taking the name from $USER. This will be made
configurable eventually.

Differential Revision: http://reviews.llvm.org/D5393

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@218049 91177308-0d34-0410-b5e6-96231b3b80d8