From b5b1f639c021edae6994eeaa52ea4ef4d6f6a05e Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Fri, 28 Jun 2024 01:24:52 +0100 Subject: [PATCH] SWDEV-470698 - add common .clang-format inside main folder Remove the redundant copies inside sub folders. This was useful when these projects were independent but now since they are merged they should have one single .clang-format file. Change-Id: I60510d7b78b129c761e84f13403492bd0c5d941a --- hipamd/.clang-format => .clang-format | 0 .gitignore | 1 + CMakeLists.txt | 11 +++++++++++ hipamd/CMakeLists.txt | 11 ----------- opencl/.clang-format | 10 ---------- rocclr/.clang-format | 10 ---------- 6 files changed, 12 insertions(+), 31 deletions(-) rename hipamd/.clang-format => .clang-format (100%) delete mode 100644 opencl/.clang-format delete mode 100644 rocclr/.clang-format diff --git a/hipamd/.clang-format b/.clang-format similarity index 100% rename from hipamd/.clang-format rename to .clang-format diff --git a/.gitignore b/.gitignore index f0245c8823..a9e456d60a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ packages/ install/ .vs/ .vscode/ +.cache/ # Editor temp files *.swp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ff7b7bd33..ef0666a2d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,3 +84,14 @@ endif() if(CLR_BUILD_OCL) add_subdirectory(opencl) endif() + +############################# +# Code formatting +############################# +# Target: clangformat +find_program(CLANGFORMAT_EXE clang-format PATHS "/opt/rocm/lib/llvm/bin") +if(CLANGFORMAT_EXE) + file(GLOB_RECURSE FORMAT_SOURCE_FILE_LIST *.cpp *.hpp *.hh *.h *.cc *.c) + add_custom_target(clangformat COMMAND ${CLANGFORMAT_EXE} -style=file -i ${FORMAT_SOURCE_FILE_LIST} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() diff --git a/hipamd/CMakeLists.txt b/hipamd/CMakeLists.txt index f2b49ef2a0..63a94898a7 100755 --- a/hipamd/CMakeLists.txt +++ b/hipamd/CMakeLists.txt @@ -458,17 +458,6 @@ if(NOT WIN32) add_subdirectory(packaging) endif() -############################# -# Code formatting -############################# -# Target: clangformat -find_program(CLANGFORMAT_EXE clang-format PATHS ${HCC_HOME}/bin) -if(CLANGFORMAT_EXE) - file(GLOB_RECURSE FORMAT_SOURCE_FILE_LIST *.cpp *.hpp *.h) - add_custom_target(clangformat COMMAND ${CLANGFORMAT_EXE} -style=file -i ${FORMAT_SOURCE_FILE_LIST} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -endif() - ############################# # Code analysis ############################# diff --git a/opencl/.clang-format b/opencl/.clang-format deleted file mode 100644 index 5572a72cdd..0000000000 --- a/opencl/.clang-format +++ /dev/null @@ -1,10 +0,0 @@ -Language: Cpp -BasedOnStyle: Google -AlignEscapedNewlinesLeft: false -AlignOperands: false -ColumnLimit: 100 -AlwaysBreakTemplateDeclarations: false -DerivePointerAlignment: false -IndentFunctionDeclarationAfterType: false -MaxEmptyLinesToKeep: 2 -SortIncludes: false diff --git a/rocclr/.clang-format b/rocclr/.clang-format deleted file mode 100644 index 5572a72cdd..0000000000 --- a/rocclr/.clang-format +++ /dev/null @@ -1,10 +0,0 @@ -Language: Cpp -BasedOnStyle: Google -AlignEscapedNewlinesLeft: false -AlignOperands: false -ColumnLimit: 100 -AlwaysBreakTemplateDeclarations: false -DerivePointerAlignment: false -IndentFunctionDeclarationAfterType: false -MaxEmptyLinesToKeep: 2 -SortIncludes: false