[llvm-bugs] [Bug 38246] New: clang-format causes compilation failure by moving #ifdef

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 20 05:40:05 PDT 2018


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

            Bug ID: 38246
           Summary: clang-format causes compilation failure by moving
                    #ifdef
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michal.ogrodnik at starcounter.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

$ cat new.cpp 
void foo()
{
    {
#ifdef WIN32
        if ((ctime - stime) > LONG_LONG_LONG_LONG_LONG) { call_this_function();
}
#endif
    }
}

$ clang-format -style=file new.cpp
void foo()
{
    {
#ifdef WIN32
        if ((ctime - stime) > LONG_LONG_LONG_LONG_LONG)
        { call_this_function(); } #endif
    }
}

$ cat .clang-format
BasedOnStyle:  Google
IndentWidth: 4
BreakBeforeBraces: Allman
AllowShortBlocksOnASingleLine: true

$ clang-format --version
clang-format version 6.0.1-svn334776-1~exp1~20180627160618.85
(branches/release_60)

system:
Ubuntu 16.04.2 LTS
$ uname -or
4.13.0-45-generic GNU/Linux

-- 
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/20180720/39d77e57/attachment-0001.html>


More information about the llvm-bugs mailing list