arphaman added a comment.

Thanks!

I guess for the sake of completeness it might be useful for handle 'this' in 
parens as well, since it could up in macros:

  #define MEMBER(x) (x)->y
  ...
  MEMBER(this)
  ...

Btw, I was curious if we could do a similar optimization in Objective-C, but 
'self' can be set to null there inside the body of a method. I guess maybe it 
would be possible to avoid the null check on self if we can prove it wasn't 
modified, but that's out of scope of this patch.



================
Comment at: lib/CodeGen/CGExprCXX.cpp:294
+  bool SkipNullCheck = false;
+  if (const auto *CMCE = dyn_cast<CXXMemberCallExpr>(CE)) {
+    SkipNullCheck =
----------------
You can avoid the '{' '}' here.


https://reviews.llvm.org/D29530



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

Reply via email to