http://llvm.org/bugs/show_bug.cgi?id=17018

            Bug ID: 17018
           Summary: Preprocessed file generated by compiler invoked with
                    -frewrite-includes option does not escape windows
                    paths
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to