cor3ntin added a comment.

This has been sitting in the queue for a while, sorry about that.
I think this makes sense in its current iteration, with the warning always on. 
Have you tried to build a large project like chrome with it?



================
Comment at: clang/lib/Sema/SemaChecking.cpp:16843
+
+  RHSExpr = RHSExpr->IgnoreImplicit();
+
----------------
Maybe we should ignore parentheses too?


================
Comment at: clang/lib/Sema/SemaChecking.cpp:16850-16856
+  const Decl *CD = CE->getCalleeDecl();
+  if (!CD)
+    return;
+
+  const FunctionDecl *FD = dyn_cast<const FunctionDecl>(CD);
+  if (!FD)
+    return;
----------------
you can use `CE->getDirectCallee()` here


================
Comment at: clang/lib/Sema/SemaChecking.cpp:16874
+    const SourceRange ReturnTypeLoc = FD->getReturnTypeSourceRange();
+    Diag(ReturnTypeLoc.getBegin(), diag::warn_pessimizing_return_by_const);
+    Diag(OpLoc, diag::note_pessimizing_return_by_const)
----------------
I think a fixit to remove the const would be nice.


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

https://reviews.llvm.org/D125402

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

Reply via email to