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: unassignedclangb...@nondot.org
          Reporter: r...@poczta.fm
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to