From f971ca6ea262ce02eb82c453f93cd35b42f8793c Mon Sep 17 00:00:00 2001 From: Fabian Ruffy <5960321+fruffy@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:03:25 +0100 Subject: [PATCH] Clean up clang-format and add a .clangd configuration. (#5075) Signed-off-by: fruffy --- .clang-format | 39 ++++++++----------- .clangd | 2 + test/CMakeLists.txt | 2 +- ...ir-traversal-test.cpp => ir-traversal.cpp} | 0 4 files changed, 19 insertions(+), 24 deletions(-) create mode 100755 .clangd rename test/gtest/{ir-traversal-test.cpp => ir-traversal.cpp} (100%) diff --git a/.clang-format b/.clang-format index 49d5d1b0ad8..c9c143d72ed 100644 --- a/.clang-format +++ b/.clang-format @@ -1,14 +1,5 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# clang-format configuration file. Intended for clang-format >= 4. -# -# For more information, see: -# -# Documentation/process/clang-format.rst -# https://clang.llvm.org/docs/ClangFormat.html -# https://clang.llvm.org/docs/ClangFormatStyleOptions.html -# --- +Language: Cpp BasedOnStyle: Google IndentWidth: 4 FixNamespaceComments: true @@ -22,16 +13,18 @@ DerivePointerAlignment: false PointerAlignment: Right Standard: c++17 IncludeCategories: -# Matches common headers first and sorts them before project includes -- Regex: '^<.+/.*\.h>' - Priority: 2000 -- Regex: '^<.+/.*>' - Priority: 4000 -- Regex: '^<.*\.h>' - Priority: 1000 -- Regex: '^<.*>' - Priority: 3000 -- Regex: 'testgen/.*' - Priority: 6000 -- Regex: '.*' - Priority: 5000 + # Matches common headers first and sorts them before project includes + - Regex: '^<.+/.*\.h>' + Priority: 2000 + - Regex: "^<.+/.*>" + Priority: 4000 + - Regex: '^<.*\.h>' + Priority: 1000 + - Regex: "^<.*>" + Priority: 3000 + - Regex: "testgen/.*" + Priority: 6000 + - Regex: ".*" + Priority: 5000 +IncludeIsMainRegex: '(_test)?$' +... diff --git a/.clangd b/.clangd new file mode 100755 index 00000000000..e95990a8fb5 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: build/ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b0b4ebc6bae..c504b4e57bc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,7 +38,7 @@ set (GTEST_UNITTEST_SOURCES gtest/hvec_map.cpp gtest/hvec_set.cpp gtest/indexed_vector.cpp - gtest/ir-traversal-test.cpp + gtest/ir-traversal.cpp gtest/json_test.cpp gtest/map.cpp gtest/midend_def_use.cpp diff --git a/test/gtest/ir-traversal-test.cpp b/test/gtest/ir-traversal.cpp similarity index 100% rename from test/gtest/ir-traversal-test.cpp rename to test/gtest/ir-traversal.cpp