[LLVMbugs] [Bug 17018] New: Preprocessed file generated by compiler invoked with -frewrite-includes option does not escape windows paths

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 27 18:29:12 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: katya_romanova at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130828/0c8e173f/attachment.html>


More information about the llvm-bugs mailing list