[PATCH] D137534: [C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/3)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 21:56:31 PST 2022


ChuanqiXu added inline comments.


================
Comment at: clang/tools/clang-scan-deps/ClangScanDeps.cpp:197
+llvm::cl::opt<std::string> P1689TargetedCommand(
+    "p1689-targeted-command", llvm::cl::Optional,
+    llvm::cl::desc("Only supported for P1689, the targeted command of which "
----------------
ChuanqiXu wrote:
> ben.boeckel wrote:
> > ben.boeckel wrote:
> > > ChuanqiXu wrote:
> > > > ben.boeckel wrote:
> > > > > ChuanqiXu wrote:
> > > > > > ben.boeckel wrote:
> > > > > > > Can this be something like `--` so that I don't have to figure out how to quote the thing (for the shell and whatever parsing Clang does internally)?
> > > > > > Yeah, it can. Both `-` and `--` are accepted. I've updated the test to disambiguate.
> > > > > I don't mean the flag using `--` as a prefix. I don't care about that. What I *do* care about is having to quote everything I'd give to `clang` here. I'd vastly prefer something like:
> > > > > 
> > > > > ```
> > > > > clang-scan-deps -p1689-targeted-file-name=… -p1689-use-command -- -flags --for ---clang --go --here
> > > > > ```
> > > > I got your point. But I prefer the current style if it won't be a problem for you to quote the options. In my imagination, it would be easier for the build systems to quote the flags than we synthesis things here. I guess there should already be one existing command line in the build system. And I feel like the current style may be more convenient and friendly for other tools to use. Could you try to use the current style?
> > > I don't think CMake has a mechanism for that at all right now. The problem is knowing how to quote things. Is it specified how Clang will parse this string into arguments? Is it platform-dependent?
> > Ah, it is the same as the compilation database parsing.
> Yeah, given cmake can generate compilation database for a long time. So I think it should be easy for cmake to fill the value.
@ben.boeckel hi, I found that there is existing component to parse the flags after "--" as the input for compilation database. So I can avoid to do too many works.  Could you visit if the current interface good for you?


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

https://reviews.llvm.org/D137534



More information about the cfe-commits mailing list