[PATCH] Avoid lexer crash with -frewrite-includes

Lubos Lunak l.lunak at centrum.cz
Wed Nov 27 10:24:50 PST 2013


 As discussed in " [PATCH] PR14795 : -frewrite-includes sometimes results in 
incorrect line number", the following leads to a crash:

$ echo -ne '#if 0\n#endif' >a.cpp
$ clang++ -frewrite-includes -E a.cpp

 The attached patch adds a trivial fix avoiding the problem. I'm not quite 
sure why the problem happens, but presumably it has something to do with the 
lexing not being driven by the preprocessor instance (so maybe that one gets 
deleted when reaching EOF?).

-- 
 Lubos Lunak
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-Lexer-LexEndOfFile-crash-with-frewrite-includes.patch
Type: text/x-diff
Size: 1319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131127/9c5ea3c6/attachment.patch>


More information about the cfe-commits mailing list