[build] Make compile_commands.json use NDEBUG (#29876)

* [build] Make compile_commands.json use NDEBUG

Ensures that things like clangd report the correct size information for
structures, which makes optimization a lot easier.

* remove -DNDEBUG from iwyus view

* fix
pull/29436/head
Craig Tiller 3 years ago committed by GitHub
parent de1e0b3e55
commit 7854f4c50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      tools/distrib/gen_compilation_database.py
  2. 5
      tools/dockerfile/grpc_iwyu/iwyu.sh

@ -90,6 +90,9 @@ def modifyCompileCommand(target, args):
options = options.replace("-std=c++0x ", "")
options = options.replace("-std=c++14 ", "")
# Add -DNDEBUG so that editors show the correct size information for structs.
options += " -DNDEBUG"
if args.vscode:
# Visual Studio Code doesn't seem to like "-iquote". Replace it with
# old-style "-I".

@ -37,7 +37,10 @@ cd ${IWYU_ROOT}
sed -i 's,^#!/usr/bin/env python,#!/usr/bin/env python3,g' ${IWYU_ROOT}/iwyu/iwyu_tool.py
sed -i 's,^#!/usr/bin/env python,#!/usr/bin/env python3,g' ${IWYU_ROOT}/iwyu/fix_includes.py
cat compile_commands.json | sed "s,\"file\": \",\"file\": \"${IWYU_ROOT}/,g" > compile_commands_for_iwyu.json
cat compile_commands.json \
| sed "s/ -DNDEBUG//g" \
| sed "s,\"file\": \",\"file\": \"${IWYU_ROOT}/,g" \
> compile_commands_for_iwyu.json
export ENABLED_MODULES='
src/core/ext

Loading…
Cancel
Save