[PATCH] D94474: [WIP][clang][cli] Test manual header search argument generation with round-trip

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 01:30:24 PST 2021


jansvoboda11 created this revision.
jansvoboda11 added reviewers: dexonsmith, Bigcheese.
Herald added a subscriber: hiraditya.
jansvoboda11 requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This patch tests the manual header search argument generation by performing a "parse, generate, parse" round-trip on each compiler invocation. This way, the manually written C++ code gets exercised by the suite of Clang's end-to-end tests. Moreover, this ensures people adding new command line options are force the implement the generation as well, either via TableGen marshalling infrastructure or manually.

It makes sense to enable this only for assert builds, so that we don't perform useless work in release builds.

Depending on our roll-out strategy, we might create more patches like this for other groups of options and upstream the work one-by-one, or put all option groups into this patch and enable round-tripping for all of -cc1 in a single commit.

Please note this is a work-in-progress. Ideally, we'll be able to get rid of the duplicate methods (parseSimpleArgs, generateCC1CommandLine) and the HeaderSearchOptSpecs array.

Depends on D94472 <https://reviews.llvm.org/D94472>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94474

Files:
  clang/include/clang/Frontend/CompilerInvocation.h
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/include/llvm/Option/ArgList.h
  llvm/lib/Option/ArgList.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94474.316020.patch
Type: text/x-patch
Size: 10100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210112/615e9f3e/attachment-0001.bin>


More information about the cfe-commits mailing list