engine
engine copied to clipboard
Test that `clangd --check` works at HEAD.
Closes https://github.com/flutter/flutter/issues/141641.
Basically, this should verify "it's possible to use VSCode+LSC, at least in theory".
I'm open to writing a test, but given it is a test I'm less sure it's valuable. Feel free to push back.
Oh sad, it looks like this won't work out of the box on CI due to RBE stuff?
I[21:02:53.409] Compile command from CDB is: [/b/s/w/ir/cache/builder/src/out/host_debug_unopt] /b/s/w/ir/cache/builder/src/buildtools/linux-x64/reclient/rewrapper --cfg=/b/s/w/ir/cache/builder/src/flutter/build/rbe/rewrapper-linux-x64.cfg --exec_root=/b/s/w/ir/cache/builder/src/ --server_address=unix:///b/s/w/ir/x/w/recipe_cleanup/rbe5tdxl4rl/reproxy.sock --labels=type=compile,compiler=clang,lang=cpp -MMD -MF obj/flutter/assets/assets.asset_manager.o.d -DUSE_OPENSSL=1 -DADDRESS_SANITIZER -DLEAK_SANITIZER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -D_DEBUG -D_GLIBCXX_DEBUG=1 -DFLUTTER_RUNTIME_MODE_DEBUG=1 -DFLUTTER_RUNTIME_MODE_PROFILE=2 -DFLUTTER_RUNTIME_MODE_RELEASE=3 -DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4 -DDART_LEGACY_API=[[deprecated]] -DFLUTTER_RUNTIME_MODE=1 -DFLUTTER_JIT_RUNTIME=1 -I../.. -Igen -I../../third_party/libcxx/include -I../../third_party/libcxxabi/include -I../../flutter/build/secondary/third_party/libcxx/config -I../../flutter -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize=leak -m64 -march=x86-64 -fPIC -pipe -pthread -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-deprecated-copy -Wno-psabi -Wno-deprecated-literal-operator -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -fvisibility=hidden --sysroot=../../build/linux/debian_sid_amd64-sysroot -Wstring-conversion -Wnewline-eof -O0 -g2 -Wunreachable-code -fvisibility-inlines-hidden -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions -c -std=c++17 -resource-dir=/b/s/w/ir/cache/builder/src/buildtools/linux-x64/clang/lib/clang/18 -- /b/s/w/ir/cache/builder/src/flutter/assets/asset_manager.cc
I[21:02:53.416] Parsing command...
E[21:02:53.450] [drv_unknown_argument] Line 1: unknown argument: '--cfg=/b/s/w/ir/cache/builder/src/flutter/build/rbe/rewrapper-linux-x64.cfg'
E[21:02:53.451] [drv_unknown_argument] Line 1: unknown argument: '--exec_root=/b/s/w/ir/cache/builder/src/'
E[21:02:53.451] [drv_unknown_argument] Line 1: unknown argument: '--server_address=unix:///b/s/w/ir/x/w/recipe_cleanup/rbe5tdxl4rl/reproxy.sock'
E[21:02:53.451] [drv_unknown_argument] Line 1: unknown argument: '--labels=type=compile,compiler=clang,lang=cpp'
I could try to code to work around this I suppose. Wdut?
clangdis getting confused by the RBE prefix. I have no idea if this will help, but it looks like a.clangdfile could possibly be taught about how to ignore some flags? https://clangd.llvm.org/config#compileflags
I think the ignored flags might be OK, I am going to try providing --clangd explicitly.
Triage: We think this is still WIP.
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.
Ok, sorry for the delay - I revived this PR and tried to make the logic to resolve clangd more robust.
Ok I now tried adding two new builders that don't do anything but (hopefully) prepare compile_commands.json ...
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).
If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.