[PATCH] D72867: [clangd] Support renaming designated initializers

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 02:38:12 PST 2020


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:639
+    void VisitDesignatedInitExpr(const DesignatedInitExpr *DIE) {
+      for (const DesignatedInitExpr::Designator &D : DIE->designators()) {
+        if (!D.isFieldDesignator())
----------------
kbobyrev wrote:
> sammccall wrote:
> > you're breaking after the first one - I think you'd like to report every one instead?
> > You'd test this with a DIE like `{ .Foo.Bar = 2 }` where `Foo` has struct type.
> > 
> > (targetDecl only reports the *last* one, because the Designator can't be a DynTypedNode, but we don't care about that here)
> Sorry, I tried to understand this comment but I wasn't able to in the end. Could you please elaborate on this?
> 
> I'm adding the test cases that I originally thought you meant, but those work correctly so I assume I didn't understand what case you were referring to.
Sorry, I'm not sure what I was thinking here - code LG.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72867





More information about the cfe-commits mailing list