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

            Bug ID: 42624
           Summary: clang-format badly format .clang-format config file
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: yv...@google.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

To reproduce, create a .clang-format config file:

    BasedOnStyle: Chromium
    ---
    Language: Java
    BasedOnStyle: Google
    ---

Then the following command wrongly put everything on the same line. 
    % clang-format -i .clang-format

This leads to the following error subsequently (when using clang-format on
other files):

    YAML:1:39: error: Unexpected token. Expected Key or Block End
    BasedOnStyle : Chromium-- - Language : Java BasedOnStyle : Google-- -
                                      ^
    Error reading /dummy/.clang-format: Invalid argument

This is likely to happen (and surprising) when formatting a whole code base:
    % git ls-files | xargs clang-format -i

-- 
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