Author: hokein
Date: Fri Aug 23 01:47:27 2019
New Revision: 369739

URL: http://llvm.org/viewvc/llvm-project?rev=369739&view=rev
Log:
[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

Modified:
    clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
    clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp

Modified: clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp?rev=369739&r1=369738&r2=369739&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp Fri Aug 23 
01:47:27 2019
@@ -52,6 +52,9 @@ void NonConstReferences::check(const Mat
   if (Function == nullptr || Function->isImplicit())
     return;
 
+  if (Function->getLocation().isMacroID())
+    return;
+
   if (!Function->isCanonicalDecl())
     return;
 

Modified: clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp?rev=369739&r1=369738&r2=369739&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp Fri 
Aug 23 01:47:27 2019
@@ -149,3 +149,7 @@ void f8(B &);
 }
 void f9(whitelist::A &);
 void f10(whitelist::B &);
+
+#define DEFINE_F(name) void name(int& a)
+
+DEFINE_F(func) {}


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to