[llvm-bugs] [Bug 43861] New: leading c-style comments mangle preprocessor macro formatting (output does not compile)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 31 07:56:40 PDT 2019


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

            Bug ID: 43861
           Summary: leading c-style comments mangle preprocessor macro
                    formatting (output does not compile)
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cole.hoosier at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 22754
  --> https://bugs.llvm.org/attachment.cgi?id=22754&action=edit
unformatted source

The reformatted output fails to compile if a C-style comment exists prior to
the '#' on a line that defines a preprocessor macro.

https://godbolt.org/z/Bg2D_P demonstrates this if you right-click the source
window and choose "Format text".


/* A leading comment */ #define FOO (3)

int main()
{
    return FOO;    
}


becomes


/* A leading comment */ #define FOO(3)

    int main() {
  return FOO;
}

-- 
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/20191031/d479f069/attachment.html>


More information about the llvm-bugs mailing list