Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.

Summary:
DynTypedMatcher::constructVariadic() where the restrict kind of the
different matchers are not related causes the matcher to have a "None"
restrict kind. This causes false negatives for anyOf and eachOf.
Change the logic to get a common ancestor if there is one.
Also added regression tests that fail without the fix.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@219118 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: If in doubt, assume '+' is a binary operator.

Before:
  #define LENGTH(x, y) (x) - (y)+1

After:
  #define LENGTH(x, y) (x) - (y) + 1

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@219119 91177308-0d34-0410-b5e6-96231b3b80d8