[PCH] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM presence)
This patch fixes broken preamble-skipping when the preamble region includes a byte order mark (BOM). Previously, parsing would fail if preamble PCH generation was enabled and a BOM was present. This also fixes preamble invalidation when a BOM appears or disappears. This may seem to be an obscure edge case, but it happens regularly with IDEs that pass buffer overrides that never (or always) have a BOM, yet the underlying file from the initial parse that generated a PCH might (or might not) have a BOM. I've included a test case for these scenarios. Differential Revision: https://reviews.llvm.org/D37491 llvm-svn: 313796
Showing
- clang/include/clang/Frontend/PrecompiledPreamble.h 0 additions, 15 deletionsclang/include/clang/Frontend/PrecompiledPreamble.h
- clang/include/clang/Lex/Lexer.h 22 additions, 5 deletionsclang/include/clang/Lex/Lexer.h
- clang/include/clang/Lex/PreprocessorOptions.h 2 additions, 2 deletionsclang/include/clang/Lex/PreprocessorOptions.h
- clang/lib/Frontend/FrontendActions.cpp 1 addition, 1 deletionclang/lib/Frontend/FrontendActions.cpp
- clang/lib/Frontend/PrecompiledPreamble.cpp 1 addition, 2 deletionsclang/lib/Frontend/PrecompiledPreamble.cpp
- clang/lib/Lex/Lexer.cpp 7 additions, 7 deletionsclang/lib/Lex/Lexer.cpp
- clang/lib/Lex/Preprocessor.cpp 3 additions, 3 deletionsclang/lib/Lex/Preprocessor.cpp
- clang/unittests/Frontend/PCHPreambleTest.cpp 44 additions, 0 deletionsclang/unittests/Frontend/PCHPreambleTest.cpp
Loading
Please register or sign in to comment