Reapply r213647 with a fix.

ASTMatchers currently have problems mixing bound TypeLoc nodes with Decl/Stmt
nodes. That should be fixed soon but for this checker there we only need the
TypeLoc to generate a fixit so postpone the potentially heavyweight AST walking
until after we know that we're going to emit a warning.

This is covered by existing test cases.

Original message:
[clang-tidy] Add a check for RAII temporaries.

This tries to find code similar that immediately destroys
an object that looks like it's trying to follow RAII.
  {
    scoped_lock(&global_mutex);
    critical_section();
  }

This checker will have false positives if someone uses this pattern
to legitimately invoke a destructor immediately (or the statement is
at the end of a scope anyway). To reduce the number we ignore this
pattern in macros (this is heavily used by gtest) and ignore objects
with no user-defined destructor.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@213738 91177308-0d34-0410-b5e6-96231b3b80d8
check_clang_tidy_fix.sh: Fail immediately if clang-tidy crashes.

Otherwise we'll get confusing messages from FileCheck instead of seeing the real issue.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@213739 91177308-0d34-0410-b5e6-96231b3b80d8
Add the fix that should've accompanied r213738.

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