MCPcopy Create free account
hub / github.com/ablab/spades / isUTF8

Function isUTF8

ext/src/llvm/JSON.cpp:532–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530}
531
532bool isUTF8(llvm::StringRef S, size_t *ErrOffset) {
533 // Fast-path for ASCII, which is valid UTF-8.
534 if (LLVM_LIKELY(isASCII(S)))
535 return true;
536
537 const UTF8 *Data = reinterpret_cast<const UTF8 *>(S.data()), *Rest = Data;
538 if (LLVM_LIKELY(isLegalUTF8String(&Rest, Data + S.size())))
539 return true;
540
541 if (ErrOffset)
542 *ErrOffset = Rest - Data;
543 return false;
544}
545
546std::string fixUTF8(llvm::StringRef S) {
547 // This isn't particularly efficient, but is only for error-recovery.

Callers 4

checkUTF8Method · 0.85
attributeBeginMethod · 0.85
ValueMethod · 0.85
ObjectKeyMethod · 0.85

Calls 4

isASCIIFunction · 0.85
isLegalUTF8StringFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected