[PATCH] D37491: [Preamble] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM presence)

Cameron via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 09:24:10 PDT 2017


cameron314 added inline comments.


================
Comment at: include/clang/Lex/Lexer.h:52
+  /// a BOM is present at the start of the file.
+  unsigned StartOffset;
+  /// \brief Size of the preamble in bytes.
----------------
ilya-biryukov wrote:
> We could simplify it further by removing `StartOffset`, leaving only `Size`.
> If you look at the code, it always uses `StartOffset + Size` now, which is effectively size with BOM.
> What do you think?
Yeah, I thought of that, but it's still nice to have the two separated.

ASTUnit.cpp, for example, checks if `Size != 0` to determine if there's a preamble (without considering the offset). This isn't in the diff because it was already like that.


https://reviews.llvm.org/D37491





More information about the cfe-commits mailing list