Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 9f91a0f4 authored by g4m4's avatar g4m4
Browse files

Merge branch 'master' into imgui

parents 24c66554 9ed44021
No related branches found
No related tags found
No related merge requests found
Pipeline #65230 failed
StatementMacros: ['UPROPERTY', 'UFUNCTION', 'UCLASS', 'USTRUCT', 'UENUM', 'UINTERFACE', 'GENERATED_BODY']
Language: Cpp
BasedOnStyle: LLVM
# Google C/C++ Code Style settings
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Author: Kehan Xue, kehan.xue (at) gmail.com
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: true
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortLambdasOnASingleLine: All
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
AfterCaseLabel: false
AfterClass: false
AfterStruct: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: false
ColumnLimit: 100
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Cpp11BracedListStyle: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 80
CompactNamespaces: false
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false # Make sure the * or & align on the left
EmptyLineBeforeAccessModifier: LogicalBlock
IndentCaseBlocks: false
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Left
SortIncludes: false
SpaceBeforeCaseColon: false
ReflowComments: false
# SeparateDefinitionBlocks: Always # Only support since clang-format 14
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
Standard: Auto
TabWidth: 2
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++11
TabWidth: 4
UseTab: Never
......@@ -2,21 +2,24 @@
# library dependencies (no recursion) for the given target
function(get_source_files target_name out_files)
set(found_files "")
if(target_name)
if(TARGET ${target_name})
get_target_property(target_source_dir ${target_name} SOURCE_DIR)
get_target_property(target_headers ${target_name} HEADER_SET_public_headers)
get_target_property(target_sources ${target_name} SOURCES)
foreach(target_source IN ITEMS ${target_sources})
cmake_path(SET source_path ${target_source})
cmake_path(GET source_path EXTENSION source_extension)
cmake_path(
ABSOLUTE_PATH
source_path
BASE_DIRECTORY
${target_source_dir}
NORMALIZE
OUTPUT_VARIABLE
absolute_path)
list(APPEND found_files "${absolute_path}")
foreach(target_source IN LISTS target_headers target_sources)
if(target_source)
cmake_path(SET source_path ${target_source})
cmake_path(GET source_path EXTENSION source_extension)
cmake_path(
ABSOLUTE_PATH
source_path
BASE_DIRECTORY
${target_source_dir}
NORMALIZE
OUTPUT_VARIABLE
absolute_path)
list(APPEND found_files "${absolute_path}")
endif()
endforeach()
endif()
set(${out_files}
......@@ -24,8 +27,36 @@ function(get_source_files target_name out_files)
PARENT_SCOPE)
endfunction()
# Retrieving all sources absolute file path for the given target, including
# libraries it directly depends on (no recursion: one level of inspection only)
function(get_target_files target_name out_files)
list(APPEND ${target_name}_sources)
get_target_property(${target_name}_libs ${target_name}
LINK_LIBRARIES)
foreach(library IN ITEMS ${${target_name}_libs})
set(library_sources "")
get_source_files(${library} library_sources)
if(library_sources)
list(APPEND ${target_name}_sources ${library_sources})
endif()
endforeach()
get_source_files(${target_name} base_sources)
list(APPEND ${target_name}_sources ${base_sources})
set(${out_files}
"${${target_name}_sources}"
PARENT_SCOPE)
endfunction()
# Dump all files (header/sources) pertaining to the given target
function(dump_target_files target_name)
get_target_files(${target_name} ${target_name}_sources)
string(REPLACE ";" "\n" temp "${${target_name}_sources}")
file(WRITE "${CMAKE_BINARY_DIR}/${target_name}source_files.txt" ${temp})
endfunction()
function(create_analysis_target target_name)
add_custom_target(${target_name}_analysis DEPENDS ${target_name}_clang_tidy)
add_custom_target(${target_name}_codeanalysis
DEPENDS ${target_name}_clang_tidy)
# clang-tidy
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
......@@ -34,7 +65,7 @@ function(create_analysis_target target_name)
${target_name}_clang_tidy
COMMAND
${Python_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/run-clang-tidy.py"
"-p${PROJECT_BINARY_DIR}" "-config-file=${PROJECT_SOURCE_DIR}/.clang-tidy"
"-p${CMAKE_BINARY_DIR}" "-config-file=${PROJECT_SOURCE_DIR}/.clang-tidy"
"-header-filter=.*sandbox(?!.*_deps|.*cpm_cache).*"
"-source-filter=.*sandbox(?!.*_deps|.*cpm_cache).*"
VERBATIM USES_TERMINAL)
......@@ -43,22 +74,11 @@ function(create_analysis_target target_name)
find_program(IWYU_COMMAND NAMES iwyu)
# We feed it the compilation database, however we filter it to direct sources
# for direct library dependencies (no recursion) for every target
list(APPEND ${target_name}_sources)
get_target_property(${target_name}_libs ${target_name}
INTERFACE_LINK_LIBRARIES)
foreach(library IN ITEMS ${${target_name}_libs})
set(library_sources "")
get_source_files(${library} library_sources)
list(APPEND ${target_name}_sources ${library_sources})
endforeach()
get_source_files(${target_name} target_sources)
list(APPEND ${target_name}_sources ${target_sources})
get_target_files(${target_name} ${target_name}_sources)
# We emit clang "errors" so they can be caught easily in the output log
# (as other passes will rather emit warnings)
add_custom_target(
${target_name}_iwyu
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/iwyu_tool.py
-p${PROJECT_BINARY_DIR} ${${target_name}_sources} -o clang-warning
-p${CMAKE_BINARY_DIR} ${${target_name}_sources} -o clang
VERBATIM USES_TERMINAL)
endfunction()
......@@ -22,9 +22,9 @@
int main(int /*argc*/, char** /*argv*/)
{
auto test = sandbox::dummygroup::DummyGroup::Make();
const char* kText(test->GetSomething());
const char* k_text(test->GetSomething());
std::printf("Done: %s\n", kText);
std::printf("Done: %s\n", k_text);
return 0;
}
# https://gist.github.com/airglow923/1fa3bda42f2b193920d7f46ee8345e04
Checks: '-*,
readability-identifier-naming'
WarningsAsErrors: ''
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.ConstexprVariablePrefix
value: k
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantPrefix
value: k
- key: readability-identifier-naming.FunctionCase
value: CamelCase
- key: readability-identifier-naming.GlobalConstantCase
value: CamelCase
- key: readability-identifier-naming.GlobalConstantPrefix
value: k
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantPrefix
value: k
- key: readability-identifier-naming.StaticVariableCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
value: '^[A-Z]+(_[A-Z]+)*_$'
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MemberPrefix
value: ''
- key: readability-identifier-naming.MemberSuffix
value: _
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.TypeAliasCase
value: CamelCase
- key: readability-identifier-naming.TypedefCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
SystemHeaders: false
......@@ -25,11 +25,11 @@ namespace sandbox
namespace dummygroup
{
static const char static_data[] = "Hello, World!";
static const char kStaticData[] = "Hello, World!";
DummyClass::DummyClass() : data_(new char[sizeof(static_data)])
DummyClass::DummyClass() : data_(new char[sizeof(kStaticData)])
{
std::memcpy(data_.get(), &static_data[0], sizeof(static_data));
std::memcpy(data_.get(), &kStaticData[0], sizeof(kStaticData));
}
const char* DummyClass::GetSomething(void)
......
clang-format --files="../../out/build/x64-windows-debug/sandbox_testsource_files.txt" -style="file:../.clang-format" -i > log.txt
\ No newline at end of file
python "./run-clang-tidy.py" "-p../out/build/x64-windows-debug" "-config-file=../identifiernaming.clang-tidy" "-header-filter=.*include[\\/\\\\](sandbox).*" "-source-filter=.*lib[\\/\\\\].*" -fix > log.txt
\ No newline at end of file
......@@ -24,6 +24,6 @@
TEST_CASE("dummy test") // NOLINT
{
auto test = sandbox::dummygroup::DummyGroup::Make();
const char* kText(test->GetSomething());
CHECK(kText != nullptr); // NOLINT
const char* k_text(test->GetSomething());
CHECK(k_text != nullptr); // NOLINT
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment