================
Comment at: clang-tidy/google/OverloadedUnaryAndCheck.cpp:30
@@ +29,3 @@
+  Finder->addMatcher(
+      decl(allOf(unless(methodDecl()),
+                 functionDecl(parameterCountIs(1), hasOverloadedOperatorName(
----------------
Why is the outer matcher just "decl" and not "functionDecl"?

================
Comment at: clang-tidy/google/OverloadedUnaryAndCheck.cpp:38
@@ +37,3 @@
+  const auto *Decl = Result.Nodes.getNodeAs<FunctionDecl>("overload");
+  diag(Decl->getLocStart(), "unary operator& is dangerous, do not use it.");
+}
----------------
The original cpplint.py message is not very clear. I think, it should say "do 
not overload it".

================
Comment at: test/clang-tidy/google-overloaded-unary-and.cpp:1
@@ +1,2 @@
+// RUN: clang-tidy %s -checks='-*,google-runtime-operator' -- | FileCheck %s 
-implicit-check-not="{{warning|error}}:"
+
----------------
With -implicit-check-not it becomes bulky. We should make both CHECK-MESSAGES 
and CHECK-FIXES optional in check_clang_tidy_fix.sh and give the script a more 
generic name.

There's no need to do it in this patch, though.

================
Comment at: test/clang-tidy/google-overloaded-unary-and.cpp:4
@@ +3,3 @@
+struct Foo {
+  void *operator&();
+// CHECK: :[[@LINE-1]]:3: warning: unary operator& is dangerous, do not use it.
----------------
How about tests with template instantiations? ;)

http://reviews.llvm.org/D4498



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to