Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Test that clangd --check works at HEAD. #50901

Merged
merged 13 commits into from
Mar 28, 2024
Merged

Conversation

matanlurey
Copy link
Contributor

@matanlurey matanlurey commented Feb 23, 2024

Work towards flutter/flutter#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.

@matanlurey
Copy link
Contributor Author

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?

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clangd is getting confused by the RBE prefix. I have no idea if this will help, but it looks like a .clangd file could possibly be taught about how to ignore some flags? https://clangd.llvm.org/config#compileflags

'command': final String path,
'file': final String file,
}) {
checkFile = p.split(file).skip(3).join(p.separator);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments here about what's being skipped would be helpful.

@@ -0,0 +1,75 @@
import 'dart:convert';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Needs the engine copyright header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@matanlurey
Copy link
Contributor Author

clangd is getting confused by the RBE prefix. I have no idea if this will help, but it looks like a .clangd file 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.

@chinmaygarde
Copy link
Member

Triage: We think this is still WIP.

@chinmaygarde chinmaygarde added the Work in progress (WIP) Not ready (yet) for review! label Feb 29, 2024
@flutter-dashboard
Copy link

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.

@matanlurey
Copy link
Contributor Author

Ok, sorry for the delay - I revived this PR and tried to make the logic to resolve clangd more robust.

'command': final String command,
'file': final String file,
}) {
// Given a path like ../../flutter/foo.cc, we want to check foo.cc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think I see. The path of file is relative to the path given by the directory entry in the entry map. You might be able to avoid manipulating the path of file entirely if you change the working directory for the clangd command to the directory path.

@matanlurey
Copy link
Contributor Author

Ok I now tried adding two new builders that don't do anything but (hopefully) prepare compile_commands.json ...

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right to me

@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 28, 2024
@flutter-dashboard
Copy link

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.

@auto-submit auto-submit bot merged commit b917b24 into flutter:main Mar 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 28, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 28, 2024
…145938)

flutter/engine@c176d11...b917b24

2024-03-28 [email protected] Test that `clangd --check` works at HEAD. (flutter/engine#50901)
2024-03-28 [email protected] Remove `--verbose` from clang_tidy execution on CI. (flutter/engine#51760)
2024-03-28 [email protected] Remove Android API v33 tests from CI. (flutter/engine#51751)
2024-03-28 [email protected] Reland: [Impeller] adds a plus advanced blend for f16 pixel formats (flutter/engine#51756)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Nov 15, 2024
Build and x64 dimension was introduced in #50901, and I blindly copied it into the .ci.yaml in #56014.  However I don't think clangd needs to run on the scarce (and flakier) Intel Macs (37 x64 bots in prod vs 55 arm bots).  Suspect this was copied from clang_tidy #26910

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
Build and x64 dimension was introduced in flutter/engine#50901, and I blindly copied it into the .ci.yaml in flutter/engine#56014.  However I don't think clangd needs to run on the scarce (and flakier) Intel Macs (37 x64 bots in prod vs 55 arm bots).  Suspect this was copied from clang_tidy flutter#26910

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App Work in progress (WIP) Not ready (yet) for review!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants