SureYeaah added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:90
+bool isAFunctionRef(const clang::Expr *Expr) {
+  const clang::DeclRefExpr *DeclRef = dyn_cast_or_null<DeclRefExpr>(Expr);
+  if (DeclRef && isa<FunctionDecl>(DeclRef->getDecl()))
----------------
sammccall wrote:
> sammccall wrote:
> > Extracting just a declrefexpr (and replacing it with another declrefexpr) 
> > doesn't seem useful. Any reason to only do this for functions, rather than 
> > all declrefexprs?
> a syntactically similar case is MemberExpr where isImplicitAccess() is true. 
> (This is referring to a method of the current class, without qualification)
Extracting
  int a = [[f]]();
yields
  auto dummy = f;
  int a = dummy();

I thought this should be prevented. But now I see there's no need to do that.
I'll add a triviality check if needed in the next patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63773



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

Reply via email to