This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix the code action `RemoveUsingNamespace`
ClosedPublic

Authored by v1nh1shungry on Nov 7 2022, 6:52 AM.

Details

Summary

Avoid adding qualifiers before user-defined literals

Diff Detail

Event Timeline

v1nh1shungry created this revision.Nov 7 2022, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 6:52 AM
v1nh1shungry requested review of this revision.Nov 7 2022, 6:52 AM
tom-anders accepted this revision.Nov 8 2022, 10:54 AM

Would be cool if in the future we could instead transform something like

using namespace std;
int main() {
   auto t = 5ms;
}

into

using namespace std::chrono_literals;
int main() {
   auto t = 5ms;
}

But I think your fix certainly improved the behavior for now, so LGTM!

clang-tools-extra/clangd/unittests/tweaks/RemoveUsingNamespaceTests.cpp
253
This revision is now accepted and ready to land.Nov 8 2022, 10:54 AM

Improve the patch

@tom-anders Thanks for reviewing and for your suggestions!

I think your suggestion is excellent, but for now, it is too complex for me to implement.

If this patch is okay, could you please help me commit it? Thanks again!

Format codes

This revision was automatically updated to reflect the committed changes.