[PATCH] D66631: [clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.
This revision was automatically updated to reflect the committed changes. Closed by commit rL369739: [clang-tidy] Dont 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=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) {} 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) {} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D66631: [clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.
hokein updated this revision to Diff 216777. hokein marked an inline comment as done. hokein added a comment. Add the missing back newline. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66631/new/ https://reviews.llvm.org/D66631 Files: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp clang-tools-extra/test/clang-tidy/google-runtime-references.cpp Index: clang-tools-extra/test/clang-tidy/google-runtime-references.cpp === --- clang-tools-extra/test/clang-tidy/google-runtime-references.cpp +++ clang-tools-extra/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) {} Index: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp === --- clang-tools-extra/clang-tidy/google/NonConstReferences.cpp +++ clang-tools-extra/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/test/clang-tidy/google-runtime-references.cpp === --- clang-tools-extra/test/clang-tidy/google-runtime-references.cpp +++ clang-tools-extra/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) {} Index: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp === --- clang-tools-extra/clang-tidy/google/NonConstReferences.cpp +++ clang-tools-extra/clang-tidy/google/NonConstReferences.cpp @@ -52,6 +52,9 @@ if (Function == nullptr || Function->isImplicit()) return; + if (Function->getLocation().isMacroID()) +return; + if (!Function->isCanonicalDecl()) return; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D66631: [clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.
gribozavr accepted this revision. gribozavr added a comment. This revision is now accepted and ready to land. LGTM, although I'd be more comfortable with a whitelist of macros. Comment at: clang-tools-extra/test/clang-tidy/google-runtime-references.cpp:156 +DEFINE_F(func) {} \ No newline at end of file Please add back the newline. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66631/new/ https://reviews.llvm.org/D66631 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D66631: [clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.
hokein created this revision. hokein added reviewers: gribozavr, alexfh. Herald added a subscriber: xazax.hun. Herald added a project: clang. The macro are usually defined in the common/base headers which are hard for normal users to modify it. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D66631 Files: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp clang-tools-extra/test/clang-tidy/google-runtime-references.cpp Index: clang-tools-extra/test/clang-tidy/google-runtime-references.cpp === --- clang-tools-extra/test/clang-tidy/google-runtime-references.cpp +++ clang-tools-extra/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) {} \ No newline at end of file Index: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp === --- clang-tools-extra/clang-tidy/google/NonConstReferences.cpp +++ clang-tools-extra/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/test/clang-tidy/google-runtime-references.cpp === --- clang-tools-extra/test/clang-tidy/google-runtime-references.cpp +++ clang-tools-extra/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) {} \ No newline at end of file Index: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp === --- clang-tools-extra/clang-tidy/google/NonConstReferences.cpp +++ clang-tools-extra/clang-tidy/google/NonConstReferences.cpp @@ -52,6 +52,9 @@ if (Function == nullptr || Function->isImplicit()) return; + if (Function->getLocation().isMacroID()) +return; + if (!Function->isCanonicalDecl()) return; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits