[clang-format] Remove duplciate code from Invalid BOM detection

Authored by MyDeveloperDay on Oct 24 2019, 12:24 PM.


[clang-format] Remove duplciate code from Invalid BOM detection

Review comments on D68767: [clang-format] NFC - Move functionality into functions to help code structure asked that this duplicated code in clang-format was moved to one central location that being SourceManager (where it had originally be copied from I assume)

Moved function into static function ContentCache::getInvalidBOM(...) - (closest class to where it was defined before)
Updated clang-format to call this static function

Added unit tests for said new function in BasicTests

Sorry not my normal code area so may have the wrong reviewers. (but your names were on the recent history)

Reviewers: bruno, arphaman, klimek, owenpan, mitchell-stellar, dexonsmith

Reviewed By: owenpan

Subscribers: cfe-commits

Tags: #clang, #clang-format, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D68914