<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang-cpp incorrectly trims whitespace after include (breaking all indent sensitive languages)."
   href="https://bugs.llvm.org/show_bug.cgi?id=34552">34552</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cpp incorrectly trims whitespace after include (breaking all indent sensitive languages).
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pantelis.antoniou@konsulko.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang-cpp incorrectly trims whitespace after an include, which results in
brokeness in all environments that are indentation sensitive: YAML is such an
environment.

GCC's CPP behaves correctly.

--- x1.yaml ---
test:
  #include "x2.yaml"
  bar:
---

--- x2.yaml ---
  sub: true
---

GCC's cpp command line and output:
$ cpp -nostdinc -I.  -x assembler-with-cpp x1.yaml >x1.cpp-gcc.yaml

--- x1.cpp-gcc.yaml ---
# 1 "x1.yaml"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "x1.yaml"
test:
# 1 "x2.yaml" 1
  sub: true
# 3 "x1.yaml" 2
  bar:
---

Note that 'sub: true' is correctly indented.

Clang's cpp command line and output:

$ clang-cpp-5.0 -nostdinc -I.  -x assembler-with-cpp x1.yaml >x1.cpp-clang.yaml
--- x1.cpp-clang.yaml ---
# 1 "x1.yaml"
# 1 "<built-in>" 1
# 1 "x1.yaml" 2
test:

# 1 "./x2.yaml" 1
  sub: true
# 3 "x1.yaml" 2
 bar:
---

Note that 'bar' is incorrectly shifted left by one space (which completely
breaks YAML formatting).

There is extra white-space after 'test:' but that doesn't cause any problems.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>