[PATCH] D81958: [clangd] Add library to semantically strip flags by name.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 00:06:06 PDT 2020


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

looks almost good.



================
Comment at: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp:197
+}
+
+TEST(ArgStripperTest, Spellings) {
----------------
sammccall wrote:
> hokein wrote:
> > add tests for stripping the diagnostic flags, `-Wfoo` etc.
> Those aren't actually separate flags: "-W" is a Joined flag and foo is an arg.
> Do you want a test specifically for such a string anyway?
> Or do you want special behavior for them? (Like interaction between -Wfoo and -Wno-foo)
I was a bit unclear about how the stripper strips the "-W/-D"-like flag, would be nice to have them in tests as I think these are important cases.

> Those aren't actually separate flags: "-W" is a Joined flag and foo is an arg.

oh, if I understand correctly:

- `strip("unused", "clang -Wunused foo.cc")` => `clang foo.cc` ?
- `strip("-W", "clang -Wunused -Wextra foo.cc")` => `clang foo.cc` // remove all -W flags ?
- `strip("error=unused", "clang -Wunused -Werror=unused -Werror=date-time foo.cc")`  =>  `clang -Wunused -Werror=date-time foo.cc`?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81958





More information about the cfe-commits mailing list