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

            Bug ID: 39646
           Summary: clang-format sorts headers even when /* clang-format
                    off */ is used
           Product: clang
           Version: 7.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: nick.rand...@booking.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

When files include "/* clang-format off */" right at the top, this is ignored
and headers are sorted anyway.

Changing this instead to "// clang-format off" makes it work as expected and
not sort the headers.

Looking through Format.cpp, in sortCppIncludes, there is an explicit check for
"// clang-format off" but not the former version, when both should work. 


Formatting is disabled as expected:

// clang-format off
#include "b.h"
#include "a.h"


Formatting re-orders headers when it shouldn't:

/* clang-format off */
#include "b.h"
#include "a.h"   <- these will be sorted

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to