NoQ added a comment.

Sorry, couldn't help it. This patch looks so useful and so lonely :)



================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6782
+def warn_member_call_in_ctor_init : Warning<
+  "member function call %0 in ctor-initializer for base class %1 results in "
+  "undefined behavior">,
----------------
I don't see these things referred to as "ctor-initializers" in other 
diagnostics. I'd rather say "initializer".

Also "has undefined behavior" is shorter and nicer.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:2295
+    // or 0 if the current CXXCtorInitializer isn't initializing a base class.
+    const Type *CurrentBaseClass;
 
----------------
I'd be scared not to initialize this variable to null.

Also, this visitor scans only one constructor throughout its lifetime, right?


================
Comment at: lib/Sema/SemaDeclCXX.cpp:2588-2589
+        // is undefined behavior.
+        // As getImplicitObjectArgument() returns 0 for member pointer
+        // calls we use dyn_cast_or_null instead of isa.
+        if (dyn_cast_or_null<CXXThisExpr>(E->getImplicitObjectArgument())) {
----------------
Ugh.

This is worth a test case!


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

https://reviews.llvm.org/D19312



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

Reply via email to