[PATCH] D41363: [clang-tidy] Adding Fuchsia checker for overloaded operators

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 14:05:52 PST 2017


aaron.ballman added a comment.

Are the Fuchsia library headers intended to also comply with this rule? I notice there's mention of a unique_ptr class, and I can't imagine that working without overloading more operators than just assignment. Perhaps this check should not be triggered for system headers?



================
Comment at: docs/clang-tidy/checks/fuchsia-overloaded-operator.rst:15
+
+  B &operator=(const B& other);  // No warning
+  B &operator=(B &&other) // No warning
----------------
`&` should bind to `other` here.


================
Comment at: test/clang-tidy/fuchsia-overloaded-operator.cpp:11
+public:
+  B &operator=(const B& other);
+  // CHECK-MESSAGES-NOT: [[@LINE-1]]:3: warning: cannot overload 'operator=' [fuchsia-overloaded-operator]
----------------
The `&` should bind to `other`. Same below. Also, the param identifier should start with a capital letter (also same below).


https://reviews.llvm.org/D41363





More information about the cfe-commits mailing list