Add partial support for the hasDeclaration() matcher in the dynamic layer.

Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method.  We do not support this right now.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D1889
[ASan] Fix PR17867 - make sure ASan doesn't crash if use-after-scope and use-after-return are combined.