[llvm-bugs] [Bug 40225] New: Formatted content inside raw string literals is indented too far

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 4 06:13:36 PST 2019


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

            Bug ID: 40225
           Summary: Formatted content inside raw string literals is
                    indented too far
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Given this source:

```
int* func1() {
    auto S = R"cpp(
int* generatedFunc1()
{
}

int *generatedFunc2()
{

}
)cpp";
}

int *func2() {}

```

and this clang-format:

```
BasedOnStyle: LLVM
IndentWidth: 4
Language: Cpp
RawStringFormats:
  - Language: Cpp
    Delimiters:
      - 'cpp'
    BasedOnStyle: llvm

```

I get this output from clang-format:

```
int *func1() {
    auto S = R"cpp(
                   int *generatedFunc1() {}

                   int *generatedFunc2() {}
    )cpp";
}

int *func2() {}
```

The content of the raw string literal is indented way too far. What I actually
want is:


```
int *func1() {
    auto S = R"cpp(
int *generatedFunc1() {}

int *generatedFunc2() {}
    )cpp";
}

int *func2() {}

```

Can that base indentation be removed somehow? An option might be to use the
indentation of the first non-empty line as the base indentation.

-- 
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/20190104/c3f195d7/attachment.html>


More information about the llvm-bugs mailing list