aaron.ballman added inline comments.

================
Comment at: clang-tidy/fuchsia/FuchsiaTidyModule.cpp:44
+    CheckFactories.registerCheck<ZxTemporaryObjectsCheck>(
+        "fuchsia-zx-temporary-objects");
   }
----------------
Do we want a zircon module instead? I'm wondering about people who enable 
modules by doing `fuchsia-*` and whether or not they would expect this check 
(and others for zircon) to be enabled.


================
Comment at: clang-tidy/fuchsia/ZxTemporaryObjectsCheck.cpp:46
+void ZxTemporaryObjectsCheck::check(const MatchFinder::MatchResult &Result) {
+  if (const auto *D = Result.Nodes.getNodeAs<CXXConstructExpr>("temps")) {
+    diag(D->getLocation(), "misuse of temporary object");
----------------
Elide braces.


================
Comment at: clang-tidy/fuchsia/ZxTemporaryObjectsCheck.cpp:47
+  if (const auto *D = Result.Nodes.getNodeAs<CXXConstructExpr>("temps")) {
+    diag(D->getLocation(), "misuse of temporary object");
+  }
----------------
I think this could be stated more clearly as "creating a temporary object of 
type %0 is prohibited" and pass in the temporary type. That will also help the 
user to identify what type is problematic in something like: `f(good_temp{}, 
bad_temp{}, good_temp{});`. I'm not tied to printing the type, but "misuse" 
suggests there's a better way to use the temporary object, which I don't think 
is a correct interpretation.


================
Comment at: clang-tidy/fuchsia/ZxTemporaryObjectsCheck.h:20
+
+/// Constructing of specific temporary objects in the Zircon kernel is
+/// discouraged. Takes the list of such discouraged temporary objects as a
----------------
Construction instead of constructing?


https://reviews.llvm.org/D44346



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

Reply via email to