Files
doris/docs/en/community/developer-guide/cpp-diagnostic-code.md
Pxl 5e4bb98900 [Chore](build) enable -Wpedantic and update lowest gcc version to 11.1 (#16290)
enable -Wpedantic and update lowest gcc version to 11.1
2023-02-03 11:28:48 +08:00

2.1 KiB

title, language
title language
C++ Code Diagnostic en

C++ Code Diagnostic

Doris support to use Clangd and Clang-Tidy to diagnostic code. Clangd and Clang-Tidy already has in LDB-toolchain,also can install by self.

Clang-Tidy

Clang-Tidy can do some diagnostic cofig, config file .clang-tidy is in Doris root path. Compared with vscode-cpptools, clangd can provide more powerful and accurate code jumping for vscode, and integrates the analysis and quick-fix functions of clang-tidy.

Enable clangd on VSCODE

First we should install clangd plugin, then edit settings.json or just change config on gui. Before using, compile be(RELEASE) and be-ut(ASAN) once to generate the corresponding compile_commands.json file.

    "clangd.path": "ldb_toolchain/bin/clangd", //clangd path
    "clangd.arguments": [
        "--background-index",
        "--clang-tidy", //enable clang-tidy
        "--compile-commands-dir=doris/be/build_Release/",
        "--completion-style=detailed",
        "-j=5", //clangd diagnostic parallelism
        "--all-scopes-completion",
        "--pch-storage=memory",
        "--pretty",
        "--query-driver=ldb_toolchain/bin/*" //path of compiler
    ],
    "clangd.trace": "output/clangd-server.log"