Skip to content

Commit 7b833ec

Browse files
committed
Update format file based on feedback, rerun it
1 parent 20e103a commit 7b833ec

File tree

116 files changed

+2054
-1583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2054
-1583
lines changed

.clang-format

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Language: Cpp
3-
# BasedOnStyle: LLVM
3+
BasedOnStyle: Microsoft
44

55
AccessModifierOffset: -4
66
AlignAfterOpenBracket: AlwaysBreak
@@ -10,39 +10,22 @@ AlignOperands: true
1010
AlignTrailingComments: true
1111
AllowAllParametersOfDeclarationOnNextLine: true
1212
AllowShortBlocksOnASingleLine: false
13-
AllowShortCaseLabelsOnASingleLine: false
14-
AllowShortFunctionsOnASingleLine: None
15-
AllowShortIfStatementsOnASingleLine: false
16-
AllowShortLambdasOnASingleLine: Empty
17-
AllowShortLoopsOnASingleLine: false
18-
AlwaysBreakAfterDefinitionReturnType: None
19-
AlwaysBreakAfterReturnType: None
13+
AllowShortLambdasOnASingleLine: Inline
2014
AlwaysBreakBeforeMultilineStrings: true
2115
AlwaysBreakTemplateDeclarations: MultiLine
2216
BinPackArguments: false
2317
BinPackParameters: false
2418
BraceWrapping:
2519
AfterCaseLabel: true
26-
AfterClass: true
27-
AfterControlStatement: true
28-
AfterEnum: true
29-
AfterFunction: true
30-
AfterNamespace: true
31-
AfterStruct: true
3220
AfterUnion: true
33-
AfterExternBlock: true
34-
BeforeCatch: true
35-
BeforeElse: true
3621
BeforeLambdaBody: true
3722
SplitEmptyFunction: false
3823
SplitEmptyRecord: false
3924
SplitEmptyNamespace: false
4025
BreakBeforeBinaryOperators: None
41-
BreakBeforeBraces: Custom
4226
BreakBeforeTernaryOperators: true
4327
BreakConstructorInitializers: AfterColon
4428
BreakStringLiterals: false
45-
ColumnLimit: 170
4629
CommentPragmas: '^ IWYU pragma:'
4730
CompactNamespaces: true
4831
ConstructorInitializerAllOnOneLineOrOnePerLine: true
@@ -58,7 +41,6 @@ IndentCaseLabels: false
5841
IncludeCategories:
5942
- Regex: '^"(stdafx.h|pch.h|precomp.h)"$'
6043
Priority: -1
61-
IndentWidth: 4
6244
IndentWrappedFunctionNames: false
6345
KeepEmptyLinesAtTheStartOfBlocks: true
6446
MacroBlockBegin: '^BEGIN_COM_MAP$|^BEGIN_CONNECTION_POINT_MAP$|^BEGIN_HELPER_NODEMAP$|^BEGIN_MODULE$|^BEGIN_MSG_MAP$|^BEGIN_OBJECT_MAP$|^BEGIN_TEST_CLASS$|^BEGIN_TEST_METHOD$|^BEGIN_TEST_METHOD_PROPERTIES$'
@@ -74,7 +56,6 @@ PenaltyBreakComment: 300
7456
PenaltyBreakFirstLessLess: 120
7557
PenaltyBreakString: 2000
7658
PenaltyExcessCharacter: 2
77-
PenaltyReturnTypeOnItsOwnLine: 1000
7859
PointerAlignment: Left
7960
SortIncludes: false
8061
SpaceAfterCStyleCast: false
@@ -88,8 +69,6 @@ SpacesInCStyleCastParentheses: false
8869
SpacesInParentheses: false
8970
SpacesInSquareBrackets: false
9071
Standard: Latest
91-
TabWidth: 4
92-
UseTab: Never
9372

9473
AttributeMacros: [
9574
CALLBACK,
@@ -173,11 +152,6 @@ StatementMacros: [
173152
CoCreatableClassWithFactory,
174153
CoCreatableClassWithFactoryEx,
175154

176-
# Additional definitions for the WIL repo
177-
_Translates_NTSTATUS_to_HRESULT_,
178-
_Translates_Win32_to_HRESULT_,
179-
_Translates_last_error_to_HRESULT_,
180-
181155
TEST_CASE,
182156
SECTION,
183157
]
@@ -187,50 +161,3 @@ TypenameMacros: [
187161
STDMETHOD,
188162
STDAPI_,
189163
]
190-
191-
# Additional definitions for the WIL repo
192-
WhitespaceSensitiveMacros: [
193-
__WI_CLANG_DISABLE_WARNING,
194-
]
195-
196-
# TODO: Only supported by clang-format version 17+
197-
# Macros:
198-
# - WI_NOEXCEPT=noexcept
199-
# - __R_FN_PARAMS_FULL=int x
200-
# - RESULT_NORETURN=[[noreturn]]
201-
---
202-
Language: CSharp
203-
AlignAfterOpenBracket: AlwaysBreak
204-
AllowShortBlocksOnASingleLine: false
205-
AllowShortCaseLabelsOnASingleLine: false
206-
AllowShortFunctionsOnASingleLine: None
207-
AllowShortIfStatementsOnASingleLine: false
208-
AllowShortLoopsOnASingleLine: false
209-
BraceWrapping:
210-
AfterCaseLabel: true
211-
AfterClass: true
212-
AfterControlStatement: true
213-
AfterEnum: true
214-
AfterFunction: true
215-
AfterNamespace: true
216-
AfterStruct: true
217-
BeforeCatch: true
218-
BeforeElse: true
219-
SplitEmptyFunction: true
220-
SplitEmptyRecord: true
221-
SplitEmptyNamespace: true
222-
BreakBeforeBraces: Custom
223-
ColumnLimit: 130
224-
DerivePointerAlignment: false
225-
IndentWidth: 4
226-
PenaltyBreakBeforeFirstCallParameter: 19
227-
PenaltyBreakComment: 300
228-
PenaltyBreakFirstLessLess: 120
229-
PenaltyBreakString: 2000
230-
PenaltyExcessCharacter: 2
231-
PenaltyReturnTypeOnItsOwnLine: 1000
232-
PointerAlignment: Left
233-
TabWidth: 4
234-
UseTab: Never
235-
...
236-

cppwinrt/cmd_reader.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ namespace cppwinrt
8181
};
8282

8383
inline void add_files_from_xml(
84-
std::set<std::string>& files, std::string const& sdk_version, std::filesystem::path const& xml_path, std::filesystem::path const& sdk_path, xml_requirement xml_path_requirement)
84+
std::set<std::string>& files,
85+
std::string const& sdk_version,
86+
std::filesystem::path const& xml_path,
87+
std::filesystem::path const& sdk_path,
88+
xml_requirement xml_path_requirement)
8589
{
8690
com_ptr<IStream> stream;
8791

8892
auto streamResult = SHCreateStreamOnFileW(xml_path.c_str(), STGM_READ, &stream.ptr);
89-
if (xml_path_requirement == xml_requirement::optional &&
90-
(streamResult == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || streamResult == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)))
93+
if (xml_path_requirement == xml_requirement::optional && (streamResult == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
94+
streamResult == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)))
9195
{
9296
return;
9397
}
@@ -144,8 +148,8 @@ namespace cppwinrt
144148
HKEY_LOCAL_MACHINE,
145149
L"SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots",
146150
0,
147-
// https://task.ms/29349404 - The SDK sometimes stores the 64 bit location into KitsRoot10 which is wrong,
148-
// this breaks 64-bit cppwinrt.exe, so work around this by forcing to use the WoW64 hive.
151+
// https://task.ms/29349404 - The SDK sometimes stores the 64 bit location into KitsRoot10 which is
152+
// wrong, this breaks 64-bit cppwinrt.exe, so work around this by forcing to use the WoW64 hive.
149153
KEY_READ | KEY_WOW64_32KEY,
150154
&key))
151155
{
@@ -299,7 +303,8 @@ namespace cppwinrt
299303

300304
struct reader
301305
{
302-
template <typename C, typename V, size_t numOptions> reader(C const argc, V const argv, const option (&options)[numOptions])
306+
template <typename C, typename V, size_t numOptions>
307+
reader(C const argc, V const argv, const option (&options)[numOptions])
303308
{
304309
#ifdef _DEBUG
305310
{
@@ -422,9 +427,11 @@ namespace cppwinrt
422427
#if defined(_WIN32) || defined(_WIN64)
423428
std::array<char, 260> local{};
424429
#ifdef _WIN64
425-
ExpandEnvironmentStringsA("%windir%\\System32\\WinMetadata", local.data(), static_cast<uint32_t>(local.size()));
430+
ExpandEnvironmentStringsA(
431+
"%windir%\\System32\\WinMetadata", local.data(), static_cast<uint32_t>(local.size()));
426432
#else
427-
ExpandEnvironmentStringsA("%windir%\\SysNative\\WinMetadata", local.data(), static_cast<uint32_t>(local.size()));
433+
ExpandEnvironmentStringsA(
434+
"%windir%\\SysNative\\WinMetadata", local.data(), static_cast<uint32_t>(local.size()));
428435
#endif
429436
add_directory(local.data());
430437
#else /* defined(_WIN32) || defined(_WIN64) */
@@ -493,12 +500,7 @@ namespace cppwinrt
493500

494501
auto files(std::string_view const& name) const
495502
{
496-
return files(
497-
name,
498-
[](auto&&)
499-
{
500-
return true;
501-
});
503+
return files(name, [](auto&&) { return true; });
502504
}
503505

504506
private:
@@ -555,18 +557,16 @@ namespace cppwinrt
555557
}
556558
}
557559

558-
template <typename O, typename L> void extract_response_file(std::string_view const& arg, O const& options, L& last)
560+
template <typename O, typename L>
561+
void extract_response_file(std::string_view const& arg, O const& options, L& last)
559562
{
560563
std::filesystem::path response_path{ std::string{ arg } };
561564
std::string extension = response_path.extension().generic_string();
562565
std::transform(
563566
extension.begin(),
564567
extension.end(),
565568
extension.begin(),
566-
[](auto c)
567-
{
568-
return static_cast<unsigned char>(::tolower(c));
569-
});
569+
[](auto c) { return static_cast<unsigned char>(::tolower(c)); });
570570

571571
// Check if misuse of @ prefix, so if directory or metadata file instead of response file.
572572
if (is_directory(response_path) || extension == ".winmd")
@@ -589,7 +589,8 @@ namespace cppwinrt
589589
}
590590
}
591591

592-
template <typename Character> static void parse_command_line(Character* cmdstart, std::vector<std::string>& argv, size_t* argument_count)
592+
template <typename Character>
593+
static void parse_command_line(Character* cmdstart, std::vector<std::string>& argv, size_t* argument_count)
593594
{
594595

595596
std::string arg;

0 commit comments

Comments
 (0)