HomePhabricator

[clang-format] [PR45614] Incorrectly indents [[nodiscard]] attribute funtions…

Authored by MyDeveloperDay on May 19 2020, 8:47 AM.

Description

[clang-format] [PR45614] Incorrectly indents [[nodiscard]] attribute funtions after a macro without semicolon

Summary:
https://bugs.llvm.org/show_bug.cgi?id=45614

[[nodiscard]] after a macro doesn't behave the same as an attribute resulting in incorrect indentation

This revision corrects that behavior

See original Mozilla bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1629756

Before:

class FooWidget : public nsBaseWidget {
public:
  FooWidget();

  NS_DECL_ISUPPORTS_INHERITED

      [[nodiscard]] nsresult
      FunctionOne();
  [[nodiscard]] nsresult FunctionTwo();
};

After:

class FooWidget : public nsBaseWidget {
public:
  FooWidget();

  NS_DECL_ISUPPORTS_INHERITED

  [[nodiscard]] nsresult FunctionOne();
  [[nodiscard]] nsresult FunctionTwo();
};

Reviewed By: Abpostelnicu

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79990