[PATCH] D44774: [Driver] Allow use of -fsyntax-only together with -MJ
David Stenberg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 28 07:22:42 PDT 2018
dstenb added a comment.
Our legacy frontend does not support -MJ, so when using that frontend for code generation, we invoke clang with -MJ, and at the same use -fsyntax-only to get the improved diagnostics that clang provides. This is idiosyncratic and probably hacky, I know, but it works well enough to for example for getting access to defines and include flags from the compilation database, and being able to run clang-tidy. So (1) does not fit our use case, unfortunately.
Our way of running should of course in itself not affect what is done upstream, but in general I don't see why someone shouldn't be allowed to do, for example, the following in their build chain:
clang -MJ - -DFOO=usual-value foo.c -o foo.out # code generation
clang -MJ - -DFOO=unusual-value -fsyntax-value foo.c # quick sanity check
and then run a tool like clang-tidy with the resulting compilation database.
Disregarding the above, I agree with the POLA issue with (1), so out of those two options the latter seems better to me.
Repository:
rC Clang
https://reviews.llvm.org/D44774
More information about the cfe-commits
mailing list