[clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.

Summary:
The macro are usually defined in the common/base headers which are hard
for normal users to modify it.

Reviewers: gribozavr, alexfh

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66631

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@369739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clang-tidy/google/NonConstReferences.cpp b/clang-tidy/google/NonConstReferences.cpp
index 6e0fcfe..95dc708 100644
--- a/clang-tidy/google/NonConstReferences.cpp
+++ b/clang-tidy/google/NonConstReferences.cpp
@@ -52,6 +52,9 @@
   if (Function == nullptr || Function->isImplicit())
     return;
 
+  if (Function->getLocation().isMacroID())
+    return;
+
   if (!Function->isCanonicalDecl())
     return;
 
diff --git a/test/clang-tidy/google-runtime-references.cpp b/test/clang-tidy/google-runtime-references.cpp
index 2abd5af..1ebbbe3 100644
--- a/test/clang-tidy/google-runtime-references.cpp
+++ b/test/clang-tidy/google-runtime-references.cpp
@@ -149,3 +149,7 @@
 }
 void f9(whitelist::A &);
 void f10(whitelist::B &);
+
+#define DEFINE_F(name) void name(int& a)
+
+DEFINE_F(func) {}