<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Preprocessed file generated by compiler invoked with -frewrite-includes option does not escape windows paths"
href="http://llvm.org/bugs/show_bug.cgi?id=17018">17018</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Preprocessed file generated by compiler invoked with -frewrite-includes option does not escape windows paths
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows XP
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>katya_romanova@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>When a compiler crashes it will create a preprocessed file using
-frewrite-includes. Unfortunately, the output in this case does not escape
backslash characters in Windows paths in # line directives which can cause
errors compiling the resulting file.
================
Example:
test.c:
#include <u.h>
u.h:
#include <stdio.h>
int main()
{
printf ("Hello, world!\n");
return 1;
}
================
Preprocessing with '-E' alone works fine:
clang test.c -I./ -E > prepr.c
clang -c prepr.c
Examining "prepr.c", the line directive is correctly escaped:
# 1 ".\\u.h" 1
However, adding -frewrite-includes option to the command line causes problems:
clang test.c -I./ -E -frewrite-includes > prepr.c
clang -c prepr.c
test.c:4:11: error: \u used with no following hex digits
#line 1 ".\u.h"
^~
test.c:8:12: warning: unknown escape sequence '\P'
#line 1 "c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\include\stdio.h"
^~
........
Examining "prepr.c", the line directive is incorrectly escaped:
#line 1 ".\u.h"
C:\Work\ToT_clang\build\bin\Debug>clang.exe -v
clang version 3.4 (189304)
Target: i686-pc-win32
Thread model: posix</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>