]> granicus.if.org Git - clang/commit
[PCH] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM...
authorCameron Desrochers <cameron@moodycamel.com>
Wed, 20 Sep 2017 19:03:37 +0000 (19:03 +0000)
committerCameron Desrochers <cameron@moodycamel.com>
Wed, 20 Sep 2017 19:03:37 +0000 (19:03 +0000)
commitaacb7039877a344e6063dc8e1214f82ef3b69fca
tree5f6f9ef10d75e2a15ca523d154686857f804788e
parent93bd7cd32dec27ea8f4a2ba67c70a54b0905dbfb
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313796 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Frontend/PrecompiledPreamble.h
include/clang/Lex/Lexer.h
include/clang/Lex/PreprocessorOptions.h
lib/Frontend/FrontendActions.cpp
lib/Frontend/PrecompiledPreamble.cpp
lib/Lex/Lexer.cpp
lib/Lex/Preprocessor.cpp
unittests/Frontend/PCHPreambleTest.cpp