[llvm-branch-commits] [clang] [llvm] Enable fexec-charset option (PR #138895)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 12 00:42:43 PDT 2025


================
@@ -0,0 +1,36 @@
+//===--- clang/Lex/LiteralConverter.h - Translator for Literals -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LEX_LITERALCONVERTER_H
+#define LLVM_CLANG_LEX_LITERALCONVERTER_H
+
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/TargetInfo.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CharSet.h"
+
+enum ConversionAction { NoConversion, ToSystemCharset, ToExecCharset };
+
+class LiteralConverter {
+  llvm::StringRef InternalCharset;
+  llvm::StringRef SystemCharset;
+  llvm::StringRef ExecCharset;
+  llvm::StringMap<llvm::CharSetConverter> CharsetConverters;
----------------
cor3ntin wrote:

Why do we need a Map?
I would expect the Preprocessor to have
   - A converter from UTF-8
   - A converter to UTF-8

We might have 2 additional in the future for wide strings, and storing 4 pointers seems fine.
We could also have a small class that stores a pair of converters ( A -> B and B -> A)


https://github.com/llvm/llvm-project/pull/138895


More information about the llvm-branch-commits mailing list