[llvm-bugs] [Bug 32461] New: C/C++ macro definitions: no alignment of escaped newlines

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 29 12:48:40 PDT 2017


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

            Bug ID: 32461
           Summary: C/C++ macro definitions: no alignment of escaped
                    newlines
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stephan.beyer at uni-osnabrueck.de
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Hi,

when definitions of a macro spans several lines,
clang-format does this:

$ clang-format-5.0 foo.cc
#define FOO(x)                                                   \
  try {                                                          \
    ::foo::do_something(x);                                      \
  } catch (...) {                                                \
    throw ::foo::special_exception;                              \
  }

I can also do this:

$ clang-format-5.0 -style='{AlignEscapedNewlinesLeft: true}' foo.cc
#define FOO(x)                      \
  try {                             \
    ::foo::do_something(x);         \
  } catch (...) {                   \
    throw ::foo::special_exception; \
  }

But what I really want is, no alignment of the backslashes:

$ cat foo.cc
#define FOO(x) \
  try { \
    ::foo::do_something(x); \
  } catch (...) { \
    throw ::foo::special_exception; \
  }

Did I overlook a way to achieve this?
If not, I'd request to add a AlignEscapedNewlines: true/false switch
(or remove AlignEscapedNewlinesLeft and add
AlignEscapedNewlines: None/Left/Right instead)

Thank you very much.

Stephan

-- 
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/20170329/b6eace37/attachment.html>


More information about the llvm-bugs mailing list