alexfh marked 5 inline comments as done.

================
Comment at: clang-tidy/misc/SizeofContainerCheck.cpp:23
@@ +22,3 @@
+  E = E->IgnoreImpCasts();
+  if (isa<BinaryOperator>(E) || isa<ConditionalOperator>(E))
+    return true;
----------------
I don't think we need to remove anything beyond the most external pair of 
parentheses.

================
Comment at: clang-tidy/misc/SizeofContainerCheck.cpp:26
@@ +25,3 @@
+  if (const auto *Op = dyn_cast<CXXOperatorCallExpr>(E)) {
+    return Op->getNumArgs() == 2 && Op->getOperator() != OO_Call &&
+           Op->getOperator() != OO_Subscript;
----------------
Do you have an example of an expression that will break when a `.size()` is 
appended to it? Note, that it should be an expression of a class type.

================
Comment at: clang-tidy/misc/SizeofContainerCheck.cpp:39
@@ +38,3 @@
+                    recordDecl(matchesName("^(::std::|::string)"),
+                               hasMethod(methodDecl(hasName("size"), 
isPublic(),
+                                                    isConst()))))))))))
----------------
Needed for code bases that use a std::string-like string class defined in the 
global namespace. Maybe we need a configuration option for custom container 
regexps. But this will likely be a follow up.


http://reviews.llvm.org/D12759



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to