Новая структура проекта

This commit is contained in:
Andrei Astafev 2021-11-27 14:46:53 +03:00
parent e71c75a0e4
commit e5d0988040
106 changed files with 317 additions and 47 deletions
CMakeLists.txtMakefile
expected
sources

81
CMakeLists.txt Normal file

@ -0,0 +1,81 @@
project(clang-naming)
cmake_minimum_required(VERSION 3.0)
find_program(
CLANG_TIDY_EXE
NAMES
clang-tidy-14
clang-tidy-13
clang-tidy-12
clang-tidy-11
clang-tidy-10
clang-tidy-9
clang-tidy)
set(TESTS
AbstractClass
ClassConstant
Class
ClassMember
ClassMethod
Constant
ConstantMember
ConstantParameter
ConstantPointerParameter
ConstexprFunction
ConstexprMethod
ConstexprVariable
EnumConstant
Enum
Function
GlobalConstant
GlobalConstantPointer
GlobalFunction
GlobalPointer
GlobalVariable
IgnoreMainLikeFunctions
InlineNamespace
LocalConstant
LocalConstantPointer
LocalPointer
LocalVariable
MacroDefinition
Member
Method
Namespace
Parameter
ParameterPack
PointerParameter
PrivateMember
PrivateMethod
ProtectedMember
ProtectedMethod
PublicMember
PublicMethod
ScopedEnumConstant
StaticConstant
StaticVariable
Struct
TemplateParameter
TemplateTemplateParameter
TypeAlias
Typedef
TypeTemplateParameter
Union
ValueTemplateParameter
Variable
VirtualMethod
)
add_custom_target(test ALL)
foreach(T ${TESTS})
add_custom_target(
${T}
COMMAND ${CMAKE_COMMAND} -E echo "Fomatting ${T}.cpp"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/sources/${T}.cpp" "${CMAKE_BINARY_DIR}/${T}.cpp"
COMMAND ${CLANG_TIDY_EXE} --fix -p ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/${T}.cpp"
COMMAND ${CMAKE_COMMAND} -E compare_files "${CMAKE_SOURCE_DIR}/expected/${T}.cpp" "${CMAKE_BINARY_DIR}/${T}.cpp"
)
add_dependencies(test ${T})
endforeach(T)

@ -7,53 +7,53 @@ UNKNOWN = \
test_Variable.cpp \
SOURCES= \
test_AbstractClass.cpp \
test_ClassConstant.cpp \
test_Class.cpp \
test_ClassMember.cpp \
test_ClassMethod.cpp \
test_ConstantMember.cpp \
test_ConstantParameter.cpp \
test_ConstantPointerParameter.cpp \
test_ConstexprFunction.cpp \
test_ConstexprMethod.cpp \
test_ConstexprVariable.cpp \
test_EnumConstant.cpp \
test_Enum.cpp \
test_Function.cpp \
test_GlobalConstant.cpp \
test_GlobalConstantPointer.cpp \
test_GlobalFunction.cpp \
test_GlobalPointer.cpp \
test_GlobalVariable.cpp \
test_InlineNamespace.cpp \
test_LocalConstant.cpp \
test_LocalConstantPointer.cpp \
test_LocalPointer.cpp \
test_LocalVariable.cpp \
test_MacroDefinition.cpp \
test_Namespace.cpp \
test_Parameter.cpp \
test_ParameterPack.cpp \
test_PointerParameter.cpp \
test_PrivateMember.cpp \
test_PrivateMethod.cpp \
test_ProtectedMember.cpp \
test_ProtectedMethod.cpp \
test_PublicMember.cpp \
test_PublicMethod.cpp \
test_ScopedEnumConstant.cpp \
test_StaticConstant.cpp \
test_StaticVariable.cpp \
test_Struct.cpp \
test_TemplateParameter.cpp \
test_TemplateTemplateParameter.cpp \
test_TypeAlias.cpp \
test_Typedef.cpp \
test_TypeTemplateParameter.cpp \
test_Union.cpp \
test_ValueTemplateParameter.cpp \
test_VirtualMethod.cpp
sources/AbstractClass.cpp \
sources/ClassConstant.cpp \
sources/Class.cpp \
sources/ClassMember.cpp \
sources/ClassMethod.cpp \
sources/ConstantMember.cpp \
sources/ConstantParameter.cpp \
sources/ConstantPointerParameter.cpp \
sources/ConstexprFunction.cpp \
sources/ConstexprMethod.cpp \
sources/ConstexprVariable.cpp \
sources/EnumConstant.cpp \
sources/Enum.cpp \
sources/Function.cpp \
sources/GlobalConstant.cpp \
sources/GlobalConstantPointer.cpp \
sources/GlobalFunction.cpp \
sources/GlobalPointer.cpp \
sources/GlobalVariable.cpp \
sources/InlineNamespace.cpp \
sources/LocalConstant.cpp \
sources/LocalConstantPointer.cpp \
sources/LocalPointer.cpp \
sources/LocalVariable.cpp \
sources/MacroDefinition.cpp \
sources/Namespace.cpp \
sources/Parameter.cpp \
sources/ParameterPack.cpp \
sources/PointerParameter.cpp \
sources/PrivateMember.cpp \
sources/PrivateMethod.cpp \
sources/ProtectedMember.cpp \
sources/ProtectedMethod.cpp \
sources/PublicMember.cpp \
sources/PublicMethod.cpp \
sources/ScopedEnumConstant.cpp \
sources/StaticConstant.cpp \
sources/StaticVariable.cpp \
sources/Struct.cpp \
sources/TemplateParameter.cpp \
sources/TemplateTemplateParameter.cpp \
sources/TypeAlias.cpp \
sources/Typedef.cpp \
sources/TypeTemplateParameter.cpp \
sources/Union.cpp \
sources/ValueTemplateParameter.cpp \
sources/VirtualMethod.cpp
OBJECTS=$(SOURCES:.cpp=.o)

@ -0,0 +1,6 @@
class AbstractClass {
public:
AbstractClass();
virtual int function();
};

6
expected/Class.cpp Normal file

@ -0,0 +1,6 @@
class TestClass {
public:
TestClass();
~TestClass();
};

@ -0,0 +1,5 @@
class ClassWithClassConstant {
public:
static int const CLASS_CONSTANT = 0;
};

5
expected/ClassMember.cpp Normal file

@ -0,0 +1,5 @@
class ClassWithClassMember {
public:
static int classMember;
};

5
expected/ClassMethod.cpp Normal file

@ -0,0 +1,5 @@
class ClassWithMethod {
public:
static int getInt() { return 0; };
};

@ -0,0 +1,5 @@
class ClassWithConstantMember {
public:
char const const_member[4] = "123";
};

@ -0,0 +1,4 @@
char returnChar(const char returnValue) {
return returnValue;
};

@ -0,0 +1,4 @@
void* returnVoid(void* const returnValue) {
return returnValue;
};

@ -0,0 +1,3 @@
constexpr int getFive() {
return ( 5 );
}

@ -0,0 +1,5 @@
class ClassWithConstexprMethod {
private:
constexpr int getInt() { return 0; };
};

@ -0,0 +1,2 @@
constexpr int const_five = 5;

2
expected/Enum.cpp Normal file

@ -0,0 +1,2 @@
enum TestEnum { ONE, TWO };

@ -0,0 +1,2 @@
enum TestEnum { ONE, TWO };

4
expected/Function.cpp Normal file

@ -0,0 +1,4 @@
static int staticFunction() {
return 0;
}

@ -0,0 +1,2 @@
const int THE_ONE = 1;

@ -0,0 +1,3 @@
void* global_pointer;
void* const global_const_pointer = global_pointer;

@ -0,0 +1,4 @@
int globalFunction() {
return 0;
}

@ -0,0 +1,2 @@
void* global_pointer;

@ -0,0 +1 @@
unsigned global_variable;

@ -0,0 +1,6 @@

@ -0,0 +1,5 @@
int functionWithLocalConstant() {
const int localConstant = 0;
return localConstant;
}

@ -0,0 +1,6 @@
void* functionWithLocalConstPointer() {
void* pointer = nullptr;
void* const localConstPointer = pointer;
return localConstPointer;
}

@ -0,0 +1,5 @@
void* function() {
void* localPointer = nullptr;
return localPointer;
}

@ -0,0 +1,5 @@
int function() {
int localVariable = 0;
return localVariable;
}

@ -0,0 +1 @@
#define MACRO_DEFINITION 0

4
expected/Namespace.cpp Normal file

@ -0,0 +1,4 @@

4
expected/Parameter.cpp Normal file

@ -0,0 +1,4 @@
int returnInt(int returnValue) {
return returnValue;
};

@ -0,0 +1,2 @@
template<class ... Types> void f(Types ... parametersPack);

@ -0,0 +1,4 @@
void* returnPtr(void* returnValue) {
return returnValue;
};

@ -0,0 +1,5 @@
class ClassWithPrivateMember {
private:
int m_privateMember;
};

@ -0,0 +1,4 @@
class ClassWithPrivateMethod {
private:
int getInt() { return 0; };
};

@ -0,0 +1,5 @@
class ClassWithProtectedMember {
protected:
int protectedMember;
};

@ -0,0 +1,5 @@
class ClassWithProtectedMethod {
protected:
int getInt() { return 0; };
};

@ -0,0 +1,5 @@
class ClassWithPublicMember {
public:
int publicMember;
};

@ -0,0 +1,5 @@
class ClassWithPublicMethod {
public:
int getInt() { return 0; };
};

@ -0,0 +1 @@
enum class TestEnum { Big, Small };

@ -0,0 +1,5 @@
int functionWithStaticConstant() {
static const int staticConstant = 0;
return staticConstant;
}

@ -0,0 +1,5 @@
int functionWithStaticVariable() {
static int staticVariable = 0;
return staticVariable;
}

3
expected/Struct.cpp Normal file

@ -0,0 +1,3 @@
struct TestStruct {
int a;
};

@ -0,0 +1,4 @@
template<typename TType>int tFunction(TType tValue) {
return 0;
}

@ -0,0 +1 @@
template<template<class T> class tplTplParameter> class AllmightyClass { };

5
expected/TypeAlias.cpp Normal file

@ -0,0 +1,5 @@
struct MyStructure {
int a;
};
using MyStructType = MyStructure;

@ -0,0 +1,4 @@
template<typename TType>int tFunction(TType value) {
return 0;
};

2
expected/Typedef.cpp Normal file

@ -0,0 +1,2 @@
typedef int my_int;

5
expected/Union.cpp Normal file

@ -0,0 +1,5 @@
union TestUnion {
int a;
char b;
};

@ -0,0 +1,4 @@
template<typename TType, int argCount> int tFunction(TType tValue) {
return 0;
}

@ -0,0 +1,4 @@
class ClassWithVirtualMethod {
private:
virtual int getInt() { return 0; };
};

1
sources/Constant.cpp Normal file

@ -0,0 +1 @@
// FIXME

@ -0,0 +1,2 @@
int main() {
}

1
sources/Member.cpp Normal file

@ -0,0 +1 @@
/// FIXME

1
sources/Method.cpp Normal file

@ -0,0 +1 @@
// FIXME

Some files were not shown because too many files have changed in this diff Show More