summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2019-05-08 13:49:17 +0000
committerOwen Pan <owenpiano@gmail.com>2019-05-08 13:49:17 +0000
commitd064c71802ac3aeec1450f0415df2ee6a36c282a (patch)
tree5710e90f2d6a33076b7603d08f73cd99a7fea110 /clang/lib/Basic/SourceManager.cpp
parente6224518230e6b0e9a920d587e51759bc88a19fa (diff)
downloadbcm5719-llvm-d064c71802ac3aeec1450f0415df2ee6a36c282a.tar.gz
bcm5719-llvm-d064c71802ac3aeec1450f0415df2ee6a36c282a.zip
[clang] Fix a bug that reports UTF32 (LE) files as UTF16 (LE) ones
Also fix a typo for the SCSU byte order mark. Differential Revision: https://reviews.llvm.org/D61628 llvm-svn: 360256
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 1b139c65523..0ffad1bc475 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -167,16 +167,16 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(DiagnosticsEngine &Diag,
// http://en.wikipedia.org/wiki/Byte_order_mark for more information.
StringRef BufStr = Buffer.getPointer()->getBuffer();
const char *InvalidBOM = llvm::StringSwitch<const char *>(BufStr)
- .StartsWith("\xFE\xFF", "UTF-16 (BE)")
- .StartsWith("\xFF\xFE", "UTF-16 (LE)")
.StartsWith(llvm::StringLiteral::withInnerNUL("\x00\x00\xFE\xFF"),
"UTF-32 (BE)")
.StartsWith(llvm::StringLiteral::withInnerNUL("\xFF\xFE\x00\x00"),
"UTF-32 (LE)")
+ .StartsWith("\xFE\xFF", "UTF-16 (BE)")
+ .StartsWith("\xFF\xFE", "UTF-16 (LE)")
.StartsWith("\x2B\x2F\x76", "UTF-7")
.StartsWith("\xF7\x64\x4C", "UTF-1")
.StartsWith("\xDD\x73\x66\x73", "UTF-EBCDIC")
- .StartsWith("\x0E\xFE\xFF", "SDSU")
+ .StartsWith("\x0E\xFE\xFF", "SCSU")
.StartsWith("\xFB\xEE\x28", "BOCU-1")
.StartsWith("\x84\x31\x95\x33", "GB-18030")
.Default(nullptr);
OpenPOWER on IntegriCloud