Skip to content

Commit

Permalink
tools: add option to gen_compilation_db for system clang (envoyproxy#…
Browse files Browse the repository at this point in the history
…29638)

Signed-off-by: Greg Greenway <ggreenway@apple.com>
  • Loading branch information
ggreenway authored Sep 15, 2023
1 parent 52d01be commit ff7e210
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/gen_compilation_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def modify_compile_command(target, args):
# old-style "-I".
options = options.replace("-iquote ", "-I ")

if args.system_clang:
if cc.find("clang"):
cc = "clang++"

if is_header(target["file"]):
options += " -Wno-pragma-once-outside-header -Wno-unused-const-variable"
options += " -Wno-unused-function"
Expand Down Expand Up @@ -118,6 +122,12 @@ def fix_compilation_database(args, db):
parser.add_argument('--vscode', action='store_true')
parser.add_argument('--include_all', action='store_true')
parser.add_argument('--exclude_contrib', action='store_true')
parser.add_argument(
'--system-clang',
action='store_true',
help=
'Use `clang++` instead of the bazel wrapper for commands. This may help if `clangd` cannot find/run the tools.'
)
parser.add_argument('--bazel', default='bazel')
parser.add_argument(
'bazel_targets', nargs='*', default=[
Expand Down

0 comments on commit ff7e210

Please sign in to comment.