Skip to content

Commit 5c3d6ce

Browse files
authored
Add special-casing for tidy with boost_unordered (#6192)
Tested locally in relation to #6182, difficult to test server-side because of the action change combined with the edge-case issue.
1 parent 63adcea commit 5c3d6ce

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

.github/workflows/clangd_tidy.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ jobs:
6666
if: steps.filter.outputs.has_cpp == 'true'
6767
run: ./scripts/create_compdb.py
6868

69+
- name: Build deps for clangd-tidy
70+
if: steps.filter.outputs.has_cpp == 'true'
71+
run: ./scripts/run_bazel.py build //scripts:deps_for_clangd_tidy
72+
6973
- name: Install clangd-tidy
7074
if: steps.filter.outputs.has_cpp == 'true'
7175
run: pip install clangd-tidy==1.1.0.post2

scripts/BUILD

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Exceptions. See /LICENSE for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
56
load("@rules_python//python:defs.bzl", "py_test")
67

78
py_test(
@@ -10,3 +11,17 @@ py_test(
1011
srcs = ["no_op_test.py"],
1112
main = "no_op_test.py",
1213
)
14+
15+
cc_library(
16+
name = "deps_for_clangd_tidy",
17+
srcs = ["deps_for_clangd_tidy.cpp"],
18+
deps = [
19+
# `@boost_unordered` uses `strip_prefix`, which results in
20+
# `_virtual_includes` being part of the `compile_commands.json`. To
21+
# support tools like `clangd-tidy`, this is intended to generate that directory.
22+
#
23+
# For example:
24+
# bazel-out/<mode>/bin/external/+_repo_rules+boost_unordered/_virtual_includes/boost_unordered
25+
"@boost_unordered",
26+
],
27+
)

scripts/deps_for_clangd_tidy.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
2+
// Exceptions. See /LICENSE for license information.
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
// This file is only validating expected includes exist. See the BUILD target
6+
// for more information.
7+
8+
#include <boost/unordered/unordered_flat_map.hpp>

0 commit comments

Comments
 (0)