[PATCH] D72282: [clang-tidy] Add `bugprone-unintended-adl`

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 10:35:13 PST 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/UnintendedADLCheck.h:13
+#include "../ClangTidyCheck.h"
+
+#include <string>
----------------
Unnecessary empty line.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unintended-adl.rst:6
+
+Finds usages of ADL (argument-dependent lookup), or potential ADL in the case of templates, that are not on the provided whitelist.
+
----------------
Please follow 80 character length limit. Same below.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unintended-adl.rst:26
+
+ADL can be surprising, and can lead to `subtle bugs <https://bugs.llvm.org/show_bug.cgi?id=44398>`_ without the utmost attention. However, it very is useful for lookup of overloaded operators, and for customization points within libraries (e.g. `swap` in the C++ standard library). As such, this check can be configured to ignore calls to overloaded operators as well as other legitimate uses of ADL specified in a whitelist.
+
----------------
Please use double back-ticks for swap (or std::swap?).


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unintended-adl.rst:35
+
+   If non-zero, ignores calls to overloaded operators using the operator syntax (e.g. `a + b`), but not the function call syntax (e.g. `operator+(a, b)`). Default is `1`.
+
----------------
Indentation. Please use double back-ticks for a + b and operator+(a, b).


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unintended-adl.rst:39
+
+   Semicolon-separated list of names that the check ignores. Default is `swap`.
----------------
Indentation. Please use double back-ticks for swap (or std::swap?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72282





More information about the cfe-commits mailing list