[PATCH] D92012: [clangd][query-driver] Extract target
Aleksandr Platonov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 04:56:20 PST 2020
ArcsinX marked 5 inline comments as done.
ArcsinX added inline comments.
================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:134
elog("System include extraction: end marker missing: {0}", Output);
- return {};
- }
-
- for (llvm::StringRef Line : llvm::make_range(StartIt, EndIt)) {
- SystemIncludes.push_back(Line.trim().str());
- vlog("System include extraction: adding {0}", Line);
+ return llvm::None;
}
----------------
Unsure about this.
Should we toss all collected data if end markes was not found?
================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:212
+ if (!Target.empty()) {
+ Cmd.CommandLine.push_back("-target");
+ Cmd.CommandLine.push_back(Target);
----------------
kadircet wrote:
> sammccall wrote:
> > `clang -target foo test.cc` seems to be a hard error in the driver if the target is unknown.
> > (vs likely *some* functionality if we just didn't set the driver)
> >
> > so this could regress some scenarios. Can we mitigate that?
> > (It's possible that we're running the driver in a mode where we proceed anyway, but I can't remember :-()
> what if target already exists in `Cmd`?
>
> also it would be nice to use `--target=X` format to be consistent with target inference from invocation name as in https://github.com/llvm/llvm-project/blob/master/clang/lib/Tooling/Tooling.cpp#L278.
I failed to find options to process in case of invalid target, so added target validation.
================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:212
+ if (!Target.empty()) {
+ Cmd.CommandLine.push_back("-target");
+ Cmd.CommandLine.push_back(Target);
----------------
ArcsinX wrote:
> kadircet wrote:
> > sammccall wrote:
> > > `clang -target foo test.cc` seems to be a hard error in the driver if the target is unknown.
> > > (vs likely *some* functionality if we just didn't set the driver)
> > >
> > > so this could regress some scenarios. Can we mitigate that?
> > > (It's possible that we're running the driver in a mode where we proceed anyway, but I can't remember :-()
> > what if target already exists in `Cmd`?
> >
> > also it would be nice to use `--target=X` format to be consistent with target inference from invocation name as in https://github.com/llvm/llvm-project/blob/master/clang/lib/Tooling/Tooling.cpp#L278.
> I failed to find options to process in case of invalid target, so added target validation.
We could specify several --target options, the last one will be used. But I am not sure should we override existing or not.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92012/new/
https://reviews.llvm.org/D92012
More information about the cfe-commits
mailing list