-
Notifications
You must be signed in to change notification settings - Fork 27
Add clang format from samples repo #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SaschaWillems
wants to merge
7
commits into
main
Choose a base branch
from
clang_format
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
14e266f
Add clang format from samples repo
SaschaWillems adf6d32
Apply clang format to all C++ source files
SaschaWillems df01a11
Fix include order on Android
SaschaWillems f1b37b5
Fix include order on Android
SaschaWillems 7085076
Merge branch 'main' into clang_format
SaschaWillems dc941ed
Reapply clang format after merge
SaschaWillems 3ea68a8
Don't sort includes
SaschaWillems File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: LLVM | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: true | ||
AlignConsecutiveDeclarations: true | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
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 | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: AfterColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 0 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeIsMainRegex: '(Test)?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: true | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: false | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 8 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 4 | ||
UseTab: ForIndentation | ||
--- | ||
Language: ObjC | ||
DisableFormat: true | ||
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,75 @@ | ||
#include <memory> | ||
#ifdef __INTELLISENSE__ | ||
#include <vulkan/vulkan_raii.hpp> | ||
# include <vulkan/vulkan_raii.hpp> | ||
#else | ||
import vulkan_hpp; | ||
#endif | ||
#include <vulkan/vk_platform.h> | ||
#include <GLFW/glfw3.h> | ||
#include <vulkan/vk_platform.h> | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
#include <stdexcept> | ||
#include <cstdlib> | ||
|
||
const uint32_t WIDTH = 800; | ||
const uint32_t WIDTH = 800; | ||
const uint32_t HEIGHT = 600; | ||
|
||
class HelloTriangleApplication { | ||
public: | ||
void run() { | ||
initWindow(); | ||
initVulkan(); | ||
mainLoop(); | ||
cleanup(); | ||
} | ||
|
||
private: | ||
GLFWwindow* window = nullptr; | ||
class HelloTriangleApplication | ||
{ | ||
public: | ||
void run() | ||
{ | ||
initWindow(); | ||
initVulkan(); | ||
mainLoop(); | ||
cleanup(); | ||
} | ||
|
||
void initWindow() { | ||
glfwInit(); | ||
private: | ||
GLFWwindow *window = nullptr; | ||
|
||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); | ||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); | ||
void initWindow() | ||
{ | ||
glfwInit(); | ||
|
||
window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr); | ||
} | ||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); | ||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); | ||
|
||
void initVulkan() { | ||
window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr); | ||
} | ||
|
||
} | ||
void initVulkan() | ||
{ | ||
} | ||
|
||
void mainLoop() { | ||
while (!glfwWindowShouldClose(window)) { | ||
glfwPollEvents(); | ||
} | ||
} | ||
void mainLoop() | ||
{ | ||
while (!glfwWindowShouldClose(window)) | ||
{ | ||
glfwPollEvents(); | ||
} | ||
} | ||
|
||
void cleanup() { | ||
glfwDestroyWindow(window); | ||
void cleanup() | ||
{ | ||
glfwDestroyWindow(window); | ||
|
||
glfwTerminate(); | ||
} | ||
glfwTerminate(); | ||
} | ||
}; | ||
|
||
int main() { | ||
try { | ||
HelloTriangleApplication app; | ||
app.run(); | ||
} catch (const std::exception& e) { | ||
std::cerr << e.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
int main() | ||
{ | ||
try | ||
{ | ||
HelloTriangleApplication app; | ||
app.run(); | ||
} | ||
catch (const std::exception &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
return EXIT_SUCCESS; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, you wanted to keep the includes sorted, just handle the android cases locally by either just including
vulkan.hpp
, or not sorting those headers by using//clang-format off
and//clang-format on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but if I enable this globally, there is a chance a maintainer forgets about that. Will try with the //clang-format off route (didn't know that existed 👍🏻)