mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-04 01:04:40 +00:00
Use the version of clang-format that comes with Visual Studio (#19821)
This pull request also (necessarily) reformats the code to match the current version. Visual Studio 2022 17.14 comes with Clang 19's `clang-format`.
This commit is contained in:
@@ -34,7 +34,7 @@ struct
|
||||
#else // DEV
|
||||
__declspec(uuid("52065414-e077-47ec-a3ac-1cc5455e1b54"))
|
||||
#endif
|
||||
OpenTerminalHere : public RuntimeClass<RuntimeClassFlags<ClassicCom | InhibitFtmBase>, IExplorerCommand, IObjectWithSite>
|
||||
OpenTerminalHere : public RuntimeClass<RuntimeClassFlags<ClassicCom | InhibitFtmBase>, IExplorerCommand, IObjectWithSite>
|
||||
{
|
||||
#pragma region IExplorerCommand
|
||||
STDMETHODIMP Invoke(IShellItemArray* psiItemArray,
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace winrt::Microsoft::TerminalApp::implementation
|
||||
{
|
||||
public:
|
||||
explicit DebugTapConnection(Microsoft::Terminal::TerminalConnection::ITerminalConnection wrappedConnection);
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/){};
|
||||
void Initialize(const Windows::Foundation::Collections::ValueSet& /*settings*/) {};
|
||||
~DebugTapConnection();
|
||||
void Start();
|
||||
void WriteInput(const winrt::array_view<const char16_t> data);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace winrt::TerminalApp::implementation
|
||||
#pragma region IPaneContent
|
||||
winrt::Windows::UI::Xaml::FrameworkElement GetRoot();
|
||||
|
||||
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings&){};
|
||||
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings&) {};
|
||||
|
||||
winrt::Windows::Foundation::Size MinimumSize() { return { 1, 1 }; };
|
||||
void Focus(winrt::Windows::UI::Xaml::FocusState reason = winrt::Windows::UI::Xaml::FocusState::Programmatic) { reason; };
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
// Default to unset, 0%.
|
||||
TaskbarState::TaskbarState() :
|
||||
TaskbarState(0, 0){};
|
||||
TaskbarState(0, 0) {};
|
||||
|
||||
TaskbarState::TaskbarState(const uint64_t dispatchTypesState, const uint64_t progressParam) :
|
||||
_State{ dispatchTypesState },
|
||||
|
||||
@@ -31,7 +31,7 @@ Author(s):
|
||||
using NewHandoffFunction = HRESULT (*)(HANDLE* in, HANDLE* out, HANDLE signal, HANDLE reference, HANDLE server, HANDLE client, const TERMINAL_STARTUP_INFO* startupInfo);
|
||||
|
||||
struct __declspec(uuid(__CLSID_CTerminalHandoff))
|
||||
CTerminalHandoff : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::ClassicCom>, ITerminalHandoff3>
|
||||
CTerminalHandoff : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::ClassicCom>, ITerminalHandoff3>
|
||||
{
|
||||
#pragma region ITerminalHandoff
|
||||
STDMETHODIMP EstablishPtyHandoff(HANDLE* in, HANDLE* out, HANDLE signal, HANDLE reference, HANDLE server, HANDLE client, const TERMINAL_STARTUP_INFO* startupInfo) override;
|
||||
|
||||
@@ -958,7 +958,7 @@ void _stdcall TerminalSetTheme(void* terminal, TerminalTheme theme, LPCWSTR font
|
||||
for (size_t tableIndex = 0; tableIndex < 16; tableIndex++)
|
||||
{
|
||||
// It's using gsl::at to check the index is in bounds, but the analyzer still calls this array-to-pointer-decay
|
||||
GSL_SUPPRESS(bounds .3)
|
||||
GSL_SUPPRESS(bounds.3)
|
||||
renderSettings.SetColorTableEntry(tableIndex, gsl::at(theme.ColorTable, tableIndex));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ Licensed under the MIT license.
|
||||
|
||||
struct
|
||||
__declspec(uuid("6068ee1b-1ea0-4804-993a-42ef0c58d867"))
|
||||
IMediaResourceContainer : public IUnknown
|
||||
IMediaResourceContainer : public IUnknown
|
||||
{
|
||||
virtual void ResolveMediaResources(const winrt::Microsoft::Terminal::Settings::Model::MediaResourceResolver& resolver) = 0;
|
||||
};
|
||||
|
||||
struct
|
||||
__declspec(uuid("9f11361c-7c8f-45c9-8948-36b66d67eca8"))
|
||||
IPathlessMediaResourceContainer : public IUnknown
|
||||
IPathlessMediaResourceContainer : public IUnknown
|
||||
{
|
||||
virtual void ResolveMediaResourcesWithBasePath(const winrt::hstring& basePath, const winrt::Microsoft::Terminal::Settings::Model::MediaResourceResolver& resolver) = 0;
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace ControlUnitTests
|
||||
public:
|
||||
MockConnection() noexcept = default;
|
||||
|
||||
void Initialize(const winrt::Windows::Foundation::Collections::ValueSet& /*settings*/){};
|
||||
void Initialize(const winrt::Windows::Foundation::Collections::ValueSet& /*settings*/) {};
|
||||
void Start() noexcept {};
|
||||
void WriteInput(const winrt::array_view<const char16_t> data)
|
||||
{
|
||||
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
|
||||
(const_cast<_RTL_CONSTANT_STRING_remove_const_template_class<sizeof((s)[0])>::T*>(s))
|
||||
|
||||
#define RTL_CONSTANT_STRING(s) \
|
||||
{ \
|
||||
sizeof(s) - sizeof((s)[0]), \
|
||||
sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
|
||||
_RTL_CONSTANT_STRING_remove_const_macro(s) \
|
||||
#define RTL_CONSTANT_STRING(s) \
|
||||
{ \
|
||||
sizeof(s) - sizeof((s)[0]), \
|
||||
sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
|
||||
_RTL_CONSTANT_STRING_remove_const_macro(s) \
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Author(s):
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct __declspec(uuid(__CLSID_CConsoleHandoff))
|
||||
CConsoleHandoff : public RuntimeClass<RuntimeClassFlags<ClassicCom>, IConsoleHandoff, IDefaultTerminalMarker>
|
||||
CConsoleHandoff : public RuntimeClass<RuntimeClassFlags<ClassicCom>, IConsoleHandoff, IDefaultTerminalMarker>
|
||||
{
|
||||
#pragma region IConsoleHandoff
|
||||
STDMETHODIMP EstablishHandoff(HANDLE server,
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace
|
||||
|
||||
if (hNtDll != nullptr)
|
||||
{
|
||||
typedef NTSTATUS (*PfnNtOpenProcess)(HANDLE ProcessHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, CLIENT_ID * ClientId);
|
||||
typedef NTSTATUS (*PfnNtOpenProcess)(HANDLE ProcessHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, CLIENT_ID* ClientId);
|
||||
|
||||
static auto pfn = (PfnNtOpenProcess)GetProcAddress(hNtDll, "NtOpenProcess");
|
||||
|
||||
|
||||
@@ -251,17 +251,17 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
|
||||
rle_pair(rle_pair&&) = default;
|
||||
rle_pair& operator=(rle_pair&&) = default;
|
||||
|
||||
constexpr rle_pair(const T& value, const S& length) noexcept(std::is_nothrow_copy_constructible_v<T>&& std::is_nothrow_copy_constructible_v<S>) :
|
||||
constexpr rle_pair(const T& value, const S& length) noexcept(std::is_nothrow_copy_constructible_v<T> && std::is_nothrow_copy_constructible_v<S>) :
|
||||
value(value), length(length)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr rle_pair(T&& value, S&& length) noexcept(std::is_nothrow_constructible_v<T>&& std::is_nothrow_constructible_v<S>) :
|
||||
constexpr rle_pair(T&& value, S&& length) noexcept(std::is_nothrow_constructible_v<T> && std::is_nothrow_constructible_v<S>) :
|
||||
value(std::forward<T>(value)), length(std::forward<S>(length))
|
||||
{
|
||||
}
|
||||
|
||||
constexpr void swap(rle_pair& other) noexcept(std::is_nothrow_swappable_v<T>&& std::is_nothrow_swappable_v<S>)
|
||||
constexpr void swap(rle_pair& other) noexcept(std::is_nothrow_swappable_v<T> && std::is_nothrow_swappable_v<S>)
|
||||
{
|
||||
if (this != std::addressof(other))
|
||||
{
|
||||
|
||||
@@ -31,16 +31,16 @@ typedef enum DPI_AWARENESS
|
||||
DPI_AWARENESS_PER_MONITOR_AWARE = 2
|
||||
} DPI_AWARENESS;
|
||||
|
||||
#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
|
||||
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
|
||||
#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT) - 1)
|
||||
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT) - 2)
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT) - 3)
|
||||
|
||||
#endif
|
||||
|
||||
// This type is being defined in RS2 but is percolating through the
|
||||
// tree. Def it here if it hasn't collided with our branch yet.
|
||||
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT) - 4)
|
||||
#endif
|
||||
|
||||
namespace Microsoft::Console::Interactivity::Win32
|
||||
|
||||
@@ -175,7 +175,7 @@ void Undo(HWND hControlWindow);
|
||||
//
|
||||
// Macros
|
||||
//
|
||||
#define AttrToRGB(Attr) (gpStateInfo->ColorTable[(Attr)&0x0F])
|
||||
#define AttrToRGB(Attr) (gpStateInfo->ColorTable[(Attr) & 0x0F])
|
||||
#define ScreenTextColor(pStateInfo) \
|
||||
(AttrToRGB(LOBYTE(pStateInfo->ScreenAttributes) & 0x0F))
|
||||
#define ScreenBkColor(pStateInfo) \
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef struct tagFACENODE
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#define TM_IS_TT_FONT(x) (((x)&TMPF_TRUETYPE) == TMPF_TRUETYPE)
|
||||
#define TM_IS_TT_FONT(x) (((x) & TMPF_TRUETYPE) == TMPF_TRUETYPE)
|
||||
#define IS_BOLD(w) ((w) >= FW_SEMIBOLD)
|
||||
#define SIZE_EQUAL(s1, s2) (((s1).X == (s2).X) && ((s1).Y == (s2).Y))
|
||||
#define POINTS_PER_INCH 72
|
||||
|
||||
@@ -52,7 +52,7 @@ Revision History:
|
||||
SendMessage(hWnd, bLB ? LB_GETTEXT : CB_GETLBTEXT, w, 0L)
|
||||
|
||||
#define lcbFINDSTRINGEXACT(hWnd, bLB, pwsz) \
|
||||
(LONG) SendMessage(hWnd, bLB ? LB_FINDSTRINGEXACT : CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pwsz)
|
||||
(LONG) SendMessage(hWnd, bLB ? LB_FINDSTRINGEXACT : CB_FINDSTRINGEXACT, (WPARAM) - 1, (LPARAM)pwsz)
|
||||
|
||||
#define lcbADDSTRING(hWnd, bLB, pwsz) \
|
||||
(LONG) SendMessage(hWnd, bLB ? LB_ADDSTRING : CB_ADDSTRING, 0, (LPARAM)pwsz)
|
||||
|
||||
@@ -678,12 +678,12 @@ void BackendD3D::_debugUpdateShaders(const RenderingPayload& p) noexcept
|
||||
struct FileVS
|
||||
{
|
||||
std::wstring_view filename;
|
||||
wil::com_ptr<ID3D11VertexShader> BackendD3D::*target;
|
||||
wil::com_ptr<ID3D11VertexShader> BackendD3D::* target;
|
||||
};
|
||||
struct FilePS
|
||||
{
|
||||
std::wstring_view filename;
|
||||
wil::com_ptr<ID3D11PixelShader> BackendD3D::*target;
|
||||
wil::com_ptr<ID3D11PixelShader> BackendD3D::* target;
|
||||
};
|
||||
|
||||
static constexpr std::array filesVS{
|
||||
|
||||
@@ -176,9 +176,9 @@ public:
|
||||
void RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat /*format*/) override {} // DECRQPSR
|
||||
StringHandler RestorePresentationState(const DispatchTypes::PresentationReportFormat /*format*/) override { return nullptr; } // DECRSPS
|
||||
|
||||
void PlaySounds(const VTParameters /*parameters*/) override{}; // DECPS
|
||||
void PlaySounds(const VTParameters /*parameters*/) override {}; // DECPS
|
||||
|
||||
void SetOptionalFeatures(const til::enumset<OptionalFeature> /*features*/) override{};
|
||||
void SetOptionalFeatures(const til::enumset<OptionalFeature> /*features*/) override {};
|
||||
};
|
||||
|
||||
#pragma warning(default : 26440) // Restore "can be declared noexcept" warning
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace fuzz
|
||||
protected:
|
||||
CFuzzBase() :
|
||||
m_fFuzzed(FALSE),
|
||||
m_iPercentageTotal(100){};
|
||||
m_iPercentageTotal(100) {};
|
||||
virtual ~CFuzzBase() = default;
|
||||
|
||||
// Converts a percentage into a valid range. Note that riTotal
|
||||
|
||||
@@ -404,8 +404,8 @@ namespace fuzz
|
||||
}
|
||||
|
||||
private:
|
||||
CFuzzLogic(){};
|
||||
virtual ~CFuzzLogic(){};
|
||||
CFuzzLogic() {};
|
||||
virtual ~CFuzzLogic() {};
|
||||
|
||||
static LPWSTR FuzzStringW_NoRealloc(__inout LPWSTR pwsz, __inout size_t& rcch)
|
||||
{
|
||||
|
||||
@@ -416,28 +416,19 @@ function Invoke-CodeFormat() {
|
||||
[switch]$IgnoreXaml
|
||||
)
|
||||
|
||||
$clangFormatPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -find "**\x64\bin\clang-format.exe"
|
||||
If ([String]::IsNullOrEmpty($clangFormatPath)) {
|
||||
Write-Error "No Visual Studio-supplied version of clang-format could be found."
|
||||
}
|
||||
|
||||
$root = Find-OpenConsoleRoot
|
||||
& "$root\dep\nuget\nuget.exe" restore "$root\tools\packages.config"
|
||||
$clangPackage = ([xml](Get-Content "$root\tools\packages.config")).packages.package | Where-Object id -like "clang-format*"
|
||||
$clangFormatPath = "$root\packages\$($clangPackage.id).$($clangPackage.version)\tools\clang-format.exe"
|
||||
Get-ChildItem -Recurse "$root\src" -Include *.cpp, *.hpp, *.h |
|
||||
Where FullName -NotLike "*Generated Files*" |
|
||||
Invoke-ClangFormat -ClangFormatPath $clangFormatPath
|
||||
|
||||
if ($IgnoreXaml) {
|
||||
# do nothing
|
||||
}
|
||||
else {
|
||||
if (-Not $IgnoreXaml) {
|
||||
Invoke-XamlFormat
|
||||
}
|
||||
}
|
||||
|
||||
#.SYNOPSIS
|
||||
# Download clang-format.exe required for code formatting
|
||||
function Get-Format()
|
||||
{
|
||||
$root = Find-OpenConsoleRoot
|
||||
& "$root\dep\nuget\nuget.exe" restore "$root\tools\packages.config"
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat,Invoke-XamlFormat,Test-XamlFormat,Get-Format
|
||||
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat,Invoke-XamlFormat,Test-XamlFormat
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="clang-format.win-x86" version="15.0.7" targetFramework="native" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user