[PATCH] D79488: [clangd] Do not offer "Add using" tweak in header files.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 06:57:45 PDT 2020
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp:181
+ const auto FileName = SM.getFileEntryForID(SM.getMainFileID())->getName();
+ if (FileName.endswith(".h") || FileName.endswith(".hpp")) {
+ return false;
----------------
can you use isHeaderFile instead? (in SourceCode.h)
================
Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:2471
+ EXPECT_UNAVAILABLE(Header + "void fun() { one::two::f^f(); }");
+ FileName = "test.hpp";
+ EXPECT_UNAVAILABLE(Header + "void fun() { one::two::f^f(); }");
----------------
no need for this extra test if using isHeaderFile
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79488/new/
https://reviews.llvm.org/D79488
More information about the cfe-commits
mailing list