[llvm-bugs] [Bug 47901] New: clang-format puts attribute bracket on a new line

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 19 06:18:24 PDT 2020


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

            Bug ID: 47901
           Summary: clang-format puts attribute bracket on a new line
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: antoshkka at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

For the following code:

struct foo {
  [[deprecated("Construct from bla-bla-bla-bla-bla-bla-bla-bla instead.
Deprecated because of bla-bla-bla-bla-bla")]] static void ParseFromFile(const
char* path);
};

The command `clang-format-10 -style=Google -i bad_clang_format.hpp` produces
the following formatting:

struct foo {
  [
      [deprecated("Construct from bla-bla-bla-bla-bla-bla-bla-bla instead. "
                  "Deprecated because of bla-bla-bla-bla-bla")]] static void
  ParseFromFile(const char* path);
};


That formatting seems wrong. Removing `-style=Google` for that particular case
fixes the formatting:

struct foo {
  [[deprecated("Construct from bla-bla-bla-bla-bla-bla-bla-bla instead. "
               "Deprecated because of bla-bla-bla-bla-bla")]] static void
  ParseFromFile(const char *path);
};


Please fix the behaviour of `-style=Google` for cases like above.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201019/232cb20f/attachment.html>


More information about the llvm-bugs mailing list