clang-scan-deps contains some command line parsing and modifications.
This patch adds support for clang-cl command options.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Seems reasonable to me, but someone who actually knows clang-scan-deps should take a look too.
clang/tools/clang-scan-deps/ClangScanDeps.cpp | ||
---|---|---|
487 | these string constants should be const char NullFile[] = .... but since it seems you're only using NullFile for the /Fo or -o options below, I'd suggest just folding it into those options instead. Then you could also avoid having to do the (Twine("/Fo") + NullFile).str() dance and could just do push_back ("/Fonul"); |
Removed /Fo option. -o is also supported by clang-cl and overrides /Fo options that are found earlier in the command line.
Rebase after https://reviews.llvm.org/D92330.
Also, improved the detection of target obj file.
Looks like this breaks tests on mac: http://45.33.8.238/macm1/174/step_6.txt
Ptal, and revert for now if it takes a while to fix
Updated the tests for clang-cl command lines:
I moved the input files to end of command line, with --, to avoid linux-style paths conflict with clang-cl arguments.
I also had to fix the code to support --, as clang-scan-deps adds arguments to the command line.
Ping!
Would anybody have a chance to take a look at this? I'd like to submit this before the LLVM 12 branch, if possible? Thanks in advance!
It would be great if you could split the -- support out into a separate patch to commit ahead of time, but I left a couple of comments since I was taking a look.
clang/lib/Tooling/Tooling.cpp | ||
---|---|---|
438–440 ↗ | (On Diff #316768) | Seems like this should break early on --. You could also avoid the subsequent llvm::find by remembering where it is. |
clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json | ||
4–11 | It's not clear why you made these changes. Can you clarify? |
Removed the support for "--" command lines, it was extracted to patch D95099.
Applied suggested fixes.
clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json | ||
---|---|---|
4–11 | The added "--" was not necessary, I removed it. -> see the new comment in the static-analyzer.c |
Thanks!
@Bigcheese, since you reviewed the original patch, are you able to take a look at the updated version?
LGTM. This is similar enough to the original patch I'm comfortable signing off, even though @Bigcheese hasn't had a chance to take a look.
This seems to break our Fucshia builds.
If we cannot do a quick fix, we need to revert this patch.
Please see the error message below:
FAIL: Clang :: ClangScanDeps/vfsoverlay.cpp (1863 of 27822) ******************** TEST 'Clang :: ClangScanDeps/vfsoverlay.cpp' FAILED ******************** Script: -- : 'RUN: at line 1'; rm -rf /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir : 'RUN: at line 2'; rm -rf /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.cdb : 'RUN: at line 3'; mkdir -p /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir : 'RUN: at line 4'; cp /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/vfsoverlay.cpp /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input.cpp : 'RUN: at line 5'; cp /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/vfsoverlay.cpp /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input_clangcl.cpp : 'RUN: at line 6'; sed -e "s|DIR|/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir|g" /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/Inputs/vfsoverlay.yaml > /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay.yaml : 'RUN: at line 7'; mkdir /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/Inputs : 'RUN: at line 8'; cp /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/Inputs/header.h /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/Inputs/header.h : 'RUN: at line 9'; sed -e "s|DIR|/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir|g" /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json > /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.cdb : 'RUN: at line 11'; clang-scan-deps -compilation-database /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.cdb -j 1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/vfsoverlay.cpp -- Exit Code: 1 Command Output (stderr): -- /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/vfsoverlay.cpp:20:11: error: CHECK: expected string not found in input // CHECK: vfsoverlay_input_clangcl.o ^ <stdin>:3:113: note: scanning from here /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/Inputs/header.h ^ <stdin>:5:98: note: possible intended match here /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input_clangcl.cpp \ ^ Input file: <stdin> Check file: /opt/s/w/ir/x/w/llvm-project/clang/test/ClangScanDeps/vfsoverlay.cpp -dump-input=help explains the following input dump. Input was: <<<<<< 1: /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input.o: \ 2: /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input.cpp \ 3: /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/Inputs/header.h check:20'0 X error: no match found 4: pt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay.yaml: \ check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5: /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/vfsoverlay_input_clangcl.cpp \ check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ check:20'1 ? possible intended match 6: /opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/ClangScanDeps/Output/vfsoverlay.cpp.tmp.dir/Inputs/header.h check:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>>>
@gulfem We're taking a look now. Could you please post a link to the full build log, including the cmake flags used?
@gulfem We're taking a look now. Could you please post a link to the full build log, including the cmake flags used?
This is the link to one of our failing builds:
https://ci.chromium.org/ui/p/fuchsia/builders/ci/clang-linux-arm64/b8849674814150864912/overview
Here, you can see the cmake flags:
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket.appspot.com/8849674814150864912/+/u/clang/configure/execution_details
Thanks! We found the issue. I think I'll revert the patch, and will reland a fixed version.
Thanks! We found the issue. I think I'll revert the patch, and will reland a fixed version.
Great, thank you!
It's not clear why you made these changes. Can you clarify?