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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 01:49:48 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369739: [clang-tidy] Don't emit google-runtime-references warning for functions defined… (authored by hokein, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66631?vs=216777&id=216778#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66631/new/

https://reviews.llvm.org/D66631

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


Index: clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
+++ clang-tools-extra/trunk/clang-tidy/google/NonConstReferences.cpp
@@ -52,6 +52,9 @@
   if (Function == nullptr || Function->isImplicit())
     return;
 
+  if (Function->getLocation().isMacroID())
+    return;
+
   if (!Function->isCanonicalDecl())
     return;
 
Index: clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/google-runtime-references.cpp
+++ clang-tools-extra/trunk/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) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66631.216778.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190823/92d4dd46/attachment.bin>


More information about the cfe-commits mailing list