[llvm-bugs] [Bug 46312] New: Adding attribute indents block

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 13 03:19:38 PDT 2020


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

            Bug ID: 46312
           Summary: Adding attribute indents block
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: robb at poczta.fm
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

When formatting with --style=Microsoft
by adding an attribute before block code, the whole block is indented (as if it
is a single instruction).
---------
Example 1:

AS IS:

   if (argc != 2)
        [[unlikely]]
        {
            std::cout << "Usage: " << argv[0] << " [cmdline]\n";
            return EXIT_FAILURE;
        }

EXPECTED:
   if (argc != 2)
   [[unlikely]]
   {
        std::cout << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
   }

EXPECTED (alternative):
   if (argc != 2) [[unlikely]]
   {
        std::cout << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
   }

---------
Example 2:

AS IS:
    if (argc != 2)
    {
        [[unlikely]]

              std::cout
              << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
    }

EXPECTED:
    if (argc != 2)
    {
        [[unlikely]]

        std::cout << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
    }

---------
Example 3:

AS IS:
    if (argc != 2)
    {
        [[unlikely]] //
              std::cout
              << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
    }

EXPECTED:
    if (argc != 2)
    {
        [[unlikely]] //
        std::cout << "Usage: " << argv[0] << " [cmdline]\n";
        return EXIT_FAILURE;
    }

-- 
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/20200613/e04f999f/attachment.html>


More information about the llvm-bugs mailing list