This is a fix of the problem (rather than a patch - D96247) discussed in
https://github.com/clangd/clangd/issues/685.
Details
- Reviewers
hokein
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This likely needs some further thought on conflict detection. Assume we have
void foo(int Argument^); // case 1 void foo(int OhWait); // case 2 void foo(int Argument); // case 3 void foo(int AnotherOne) {} // case 4
What should we do when renaming Argument? Just rename all of them? Only rename in places where the name matches the original one (case 3)? Bail out and report an error? Also, there is no easy way to check all of these cases within our existing conflict detection pipeline: IIUC we'd need to walk the whole AST again for that (like we do in this patch within the rename pipeline).
@sammccall this is the argument renaming diff I was talking about during the standup.
Ping! Do you think this is a reasonable idea? I think if we just check whether there aren't any references to the function outside of the main file we should be safe enough to rename args.
I think this is a great use case for pseudo parser actually (unfortunately requires some multi-file interactions). In theory we can just fetch all the references, pseudo-parse the files, and update all the declarations & definitions to have the same parameter name.
My 2 cents for limiting to single-file cases initially;
It sounds like a better option to make the functionality less surprising, but I think we'll still end up confusing the users, so I am not sure if it is worth.