summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendActions.cpp
diff options
context:
space:
mode:
authorCameron Desrochers <cameron@moodycamel.com>2017-09-20 19:03:37 +0000
committerCameron Desrochers <cameron@moodycamel.com>2017-09-20 19:03:37 +0000
commit84fd064ef98b8f38426ac2e118717ec2b66fb87a (patch)
tree44140cdbd496938997931d049f71ac4adbf17cc2 /clang/lib/Frontend/FrontendActions.cpp
parentd95ed959d8ab270808aeec8b31f06140e68834ea (diff)
downloadbcm5719-llvm-84fd064ef98b8f38426ac2e118717ec2b66fb87a.tar.gz
bcm5719-llvm-84fd064ef98b8f38426ac2e118717ec2b66fb87a.zip
[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
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 3e3483d2c6b..86460f17d0f 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -591,7 +591,7 @@ void PrintPreambleAction::ExecuteAction() {
auto Buffer = CI.getFileManager().getBufferForFile(getCurrentFile());
if (Buffer) {
unsigned Preamble =
- Lexer::ComputePreamble((*Buffer)->getBuffer(), CI.getLangOpts()).first;
+ Lexer::ComputePreamble((*Buffer)->getBuffer(), CI.getLangOpts()).Size;
llvm::outs().write((*Buffer)->getBufferStart(), Preamble);
}
}
OpenPOWER on IntegriCloud