Introduce brave/.clangd config. (#17299)

This commit is contained in:
Aleksey Khoroshilov
2023-02-23 00:08:41 +07:00
committed by GitHub
parent f487577119
commit b8e1a6833c
3 changed files with 30 additions and 16 deletions
+18
View File
@@ -0,0 +1,18 @@
# Copyright (c) 2023 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/.
# Enable strict unused includes check.
If:
PathMatch: [.*\.h, .*\.cc, .*\.mm]
Diagnostics:
UnusedIncludes: Strict
---
# Disable unused const variables warning in headers. Clangd may build .h files
# directly, which triggers this warning on clang-cl (only on Windows).
If:
PathMatch: .*\.h
CompileFlags:
Add: -Wnounused-const-variable
+4 -5
View File
@@ -35,12 +35,11 @@
*.xslt text eol=lf
*.xtb text eol=lf
.clang-format text eol=lf
.eslintrc.js text eol=lf
.clang* text eol=lf
.git-blame-ignore-revs text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
.vpython text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
.vpython* text eol=lf
DEPS text eol=lf
LICENSE text eol=lf
@@ -8,7 +8,7 @@ import re
import override_utils
# Remove redirect_cc from the command line.
GOMACC_PATTERN_TO_REPLACE = ('gomacc(\.exe)', '(gomacc|redirect_cc)(\.exe)')
GOMACC_PATTERN_TO_REPLACE = (r'gomacc(\.exe)', r'(gomacc|redirect_cc)(\.exe)')
# pylint: disable=used-before-assignment
assert GOMACC_PATTERN_TO_REPLACE[0] in _GOMA_CMD_LINE_RE.pattern
@@ -19,14 +19,11 @@ _GOMA_CMD_LINE_RE = re.compile(
@override_utils.override_function(globals())
def _FilterFlags(original_function, command, additional_filtered_flags):
flags = original_function(command, additional_filtered_flags)
if additional_filtered_flags:
# Use --filter_arg to pass brave-specific args to apply here.
flags_to_restore = {
'brave-keep-bitint256':
' -Xclang -fexperimental-max-bitint-width=256',
}
for external_flag, flag_to_restore in flags_to_restore.items():
if external_flag in additional_filtered_flags:
if flag_to_restore in command and flag_to_restore not in flags:
flags += flag_to_restore
flags_to_restore = [
# Clangd 15+ is required, VSCode extension includes it.
' -Xclang -fexperimental-max-bitint-width=256',
]
for flag_to_restore in flags_to_restore:
if flag_to_restore in command and flag_to_restore not in flags:
flags += flag_to_restore
return flags