Speed up hasName() matcher.

Summary:
Speed up hasName() matcher by skipping the expensive generation of the
fully qualified name unless we need it.
In the common case of matching an unqualified name, we don't need to
generate the full name. We might not even need to copy any string at
all.
This change speeds up our clang-tidy benchmark by ~10%

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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