rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Couple of thoughts, but LGTM.


================
Comment at: lib/Sema/SemaExprMember.cpp:889
@@ +888,3 @@
+    S = S->getParent();
+  } while (S != S->getFnParent());
+  return false;
----------------
Maybe convert from a do-while into a while loop (or even a for loop)? We might 
not be in a function at all (for instance, we might be in a default member 
initializer), and that would let us bail out earlier in that case.

================
Comment at: lib/Sema/SemaExprMember.cpp:969-972
@@ +968,6 @@
+  if (S && BaseExpr && isa<CXXThisExpr>(BaseExpr->IgnoreImpCasts()) &&
+      IsInFnTryBlockHandler(S)) {
+    const auto *FD = getCurFunctionDecl();
+    bool IsDestructor = isa<CXXDestructorDecl>(FD);
+    if (IsDestructor || isa<CXXConstructorDecl>(FD)) {
+      Diag(MemberLoc, diag::warn_cdtor_function_try_handler_mem_expr)
----------------
The `FD` checks are cheaper than the scope check; maybe reorder this to check 
the kind of the function first?


http://reviews.llvm.org/D12301



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

Reply via email to