Skip to content

Commit

Permalink
Mark generated buildflag headers with IWYU always_keep pragma. (#23823)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodov committed May 24, 2024
1 parent d603893 commit d04b4ad
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions patches/build-write_buildflag_header.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/build/write_buildflag_header.py b/build/write_buildflag_header.py
index a8b68f9e82cd408c30fba82d10b1cb47a253382a..6cc80ea04c03939765f655846a6eb63061a80b9c 100755
--- a/build/write_buildflag_header.py
+++ b/build/write_buildflag_header.py
@@ -86,6 +86,9 @@ def WriteHeader(options):
output_file.write('\n#ifndef %s\n' % options.header_guard)
output_file.write('#define %s\n\n' % options.header_guard)
output_file.write('#include "build/buildflag.h" // IWYU pragma: export\n\n')
+ # Clangd does not detect BUILDFLAG_INTERNAL_* indirect usage, so mark the
+ # header as "always_keep" to avoid "unused include" warning.
+ output_file.write('// IWYU pragma: always_keep\n\n')

for pair in options.flags:
output_file.write('#define BUILDFLAG_INTERNAL_%s() (%s)\n' % pair)

0 comments on commit d04b4ad

Please sign in to comment.