================
@@ -448,6 +530,41 @@ ContentCache &SourceManager::createMemBufferContentCache(
   return *Entry;
 }
 
+llvm::ErrorOr<llvm::TextEncodingConverter *>
+SourceManager::getOrCreateConverter(llvm::StringRef SourceEncoding) {
+  // Use getKnownEncoding to get normalized encoding names
+  std::optional<llvm::TextEncoding> SourceKnown =
+      llvm::TextEncodingConverter::getKnownEncoding(SourceEncoding);
+
+  if (SourceKnown && *SourceKnown == llvm::TextEncoding::UTF8)
+    return nullptr;
+
+  // Create a cache key using canonical encoding name
+  llvm::StringRef CacheKey =
+      SourceKnown
+          ? llvm::TextEncodingConverter::getKnownEncodingName(*SourceKnown)
+          : SourceEncoding;
----------------
cor3ntin wrote:

can the second branch of that ternary ever been taken?
ie all the known encodings should have a name

https://github.com/llvm/llvm-project/pull/206519
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to