Sylvetre, is the problem below a clang-format bug or setting we can work around? clang-format insists on indenting the first `Create()` function declaration here: https://phabricator.services.mozilla.com/D68148#change-ItZetrh2GZ7W ``` class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa { ... NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSPIWIDGETCOCOA [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const DesktopIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; ``` clang-format mistakenly thinks the `NS_DECL_NSPIWIDGETCOCOA` macro a couple lines before should be part of the `Create()` function declaration. The `NS_DECL_NSPIWIDGETCOCOA` macro injects some function declarations should not impact the indentation level of surrounding code. The macro definition contains a trailing semicolon, so the use of `NS_DECL_NSPIWIDGETCOCOA` should not add its own semicolon. https://searchfox.org/mozilla-central/source/__GENERATED__/dist/include/nsPIWidgetCocoa.h#52-57 To work around this, I have to add: ``` class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa { ... // clang-format off NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSPIWIDGETCOCOA [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const DesktopIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; // clang-format on [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; ```
Bug 1624786 Comment 11 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Sylvetre, is the problem below a clang-format bug or setting we can work around? clang-format insists on indenting the first `Create()` function declaration here: https://phabricator.services.mozilla.com/D68148#change-ItZetrh2GZ7W ``` class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa { ... NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSPIWIDGETCOCOA [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const DesktopIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; ``` clang-format mistakenly thinks the `NS_DECL_NSPIWIDGETCOCOA` macro a couple lines before the `[[nodiscard]]` should be part of the `Create()` function declaration. The `NS_DECL_NSPIWIDGETCOCOA` macro injects some function declarations should not impact the indentation level of surrounding code. I feel this is a clang-format bug. https://searchfox.org/mozilla-central/source/__GENERATED__/dist/include/nsPIWidgetCocoa.h#52-57 To work around this, I have to add: ``` class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa { ... // clang-format off NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSPIWIDGETCOCOA [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const DesktopIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; // clang-format on [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr) override; ```