Add clang-format
This commit is contained in:
parent
3310901ce3
commit
da05848f04
94
.clang-format
Normal file
94
.clang-format
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlinesLeft: false
|
||||||
|
AlignOperands: false
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 120
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 8
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
IncludeIsMainRegex: '$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
...
|
||||||
|
|
||||||
@ -46,3 +46,11 @@ set_target_properties(tests PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENER
|
|||||||
install(FILES ${LUA_SOURCES} ${LUA_TEST_SOURCES}
|
install(FILES ${LUA_SOURCES} ${LUA_TEST_SOURCES}
|
||||||
DESTINATION ${CMAKE_BINARY_DIR}
|
DESTINATION ${CMAKE_BINARY_DIR}
|
||||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
|
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
|
||||||
|
|
||||||
|
#----------
|
||||||
|
# FORMAT -
|
||||||
|
#----------
|
||||||
|
add_custom_target(
|
||||||
|
format
|
||||||
|
COMMAND clang-format -i ${TEST_SOURCES} ${SOURCES}
|
||||||
|
)
|
||||||
|
|||||||
@ -24,11 +24,11 @@ extern "C" int luaopen_libeffil(lua_State *L) {
|
|||||||
SharedTable::getUserType(lua);
|
SharedTable::getUserType(lua);
|
||||||
ThreadFactory::getUserType(lua);
|
ThreadFactory::getUserType(lua);
|
||||||
sol::table public_api = lua.create_table_with(
|
sol::table public_api = lua.create_table_with(
|
||||||
"thread", createThreadFactory,
|
"thread", createThreadFactory, //
|
||||||
"thread_id", threadId,
|
"thread_id", threadId, //
|
||||||
"sleep", sleep,
|
"sleep", sleep, //
|
||||||
"yield", yield,
|
"yield", yield, //
|
||||||
"share", createShare
|
"share", createShare //
|
||||||
);
|
);
|
||||||
sol::stack::push(lua, public_api);
|
sol::stack::push(lua, public_api);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -19,10 +19,10 @@ SharedTable::SharedTable(const SharedTable& init)
|
|||||||
|
|
||||||
sol::object SharedTable::getUserType(sol::state_view &lua) {
|
sol::object SharedTable::getUserType(sol::state_view &lua) {
|
||||||
static sol::usertype<SharedTable> type(
|
static sol::usertype<SharedTable> type(
|
||||||
"new", sol::no_constructor,
|
"new", sol::no_constructor, //
|
||||||
sol::meta_function::new_index, &SharedTable::luaSet,
|
sol::meta_function::new_index, &SharedTable::luaSet,//
|
||||||
sol::meta_function::index, &SharedTable::luaGet,
|
sol::meta_function::index, &SharedTable::luaGet,//
|
||||||
sol::meta_function::length, &SharedTable::size
|
sol::meta_function::length, &SharedTable::size //
|
||||||
);
|
);
|
||||||
sol::stack::push(lua, type);
|
sol::stack::push(lua, type);
|
||||||
return sol::stack::pop<sol::object>(lua);
|
return sol::stack::pop<sol::object>(lua);
|
||||||
|
|||||||
@ -167,11 +167,11 @@ std::string LuaThread::status() const
|
|||||||
sol::object LuaThread::getUserType(sol::state_view &lua)
|
sol::object LuaThread::getUserType(sol::state_view &lua)
|
||||||
{
|
{
|
||||||
static sol::usertype<LuaThread> type(
|
static sol::usertype<LuaThread> type(
|
||||||
"new", sol::no_constructor,
|
"new", sol::no_constructor, //
|
||||||
"cancel", &LuaThread::cancel,
|
"cancel", &LuaThread::cancel, //
|
||||||
"pause", &LuaThread::pause,
|
"pause", &LuaThread::pause, //
|
||||||
"resume", &LuaThread::resume,
|
"resume", &LuaThread::resume, //
|
||||||
"status", &LuaThread::status,
|
"status", &LuaThread::status, //
|
||||||
"wait", &LuaThread::wait
|
"wait", &LuaThread::wait
|
||||||
);
|
);
|
||||||
sol::stack::push(lua, type);
|
sol::stack::push(lua, type);
|
||||||
@ -248,12 +248,12 @@ std::string ThreadFactory::packageCPath(const sol::optional<std::string>& value)
|
|||||||
sol::object ThreadFactory::getUserType(sol::state_view &lua)
|
sol::object ThreadFactory::getUserType(sol::state_view &lua)
|
||||||
{
|
{
|
||||||
static sol::usertype<ThreadFactory> type(
|
static sol::usertype<ThreadFactory> type(
|
||||||
"new", sol::no_constructor,
|
"new", sol::no_constructor, //
|
||||||
sol::meta_function::call, &ThreadFactory::runThread,
|
sol::meta_function::call, &ThreadFactory::runThread,//
|
||||||
"stepwise", &ThreadFactory::stepwise,
|
"stepwise", &ThreadFactory::stepwise, //
|
||||||
"step", &ThreadFactory::step,
|
"step", &ThreadFactory::step, //
|
||||||
"package_path", &ThreadFactory::packagePath,
|
"package_path", &ThreadFactory::packagePath, //
|
||||||
"package_cpath", &ThreadFactory::packageCPath
|
"package_cpath", &ThreadFactory::packageCPath //
|
||||||
);
|
);
|
||||||
sol::stack::push(lua, type);
|
sol::stack::push(lua, type);
|
||||||
return sol::stack::pop<sol::object>(lua);
|
return sol::stack::pop<sol::object>(lua);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ void sleep(int64_t, sol::optional<std::string>);
|
|||||||
class LuaThread {
|
class LuaThread {
|
||||||
public:
|
public:
|
||||||
enum class ThreadStatus {
|
enum class ThreadStatus {
|
||||||
Running,
|
Running = 1,
|
||||||
Paused,
|
Paused,
|
||||||
Canceled,
|
Canceled,
|
||||||
Completed,
|
Completed,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user