[llvm] [llvm-strings] Add --encoding={s,S,u} option (PR #221794)
Harald van Dijk via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 04:17:30 PDT 2026
================
@@ -71,7 +75,10 @@ static cl::list<std::string> InputFileNames(cl::Positional,
static int MinLength = 4;
static bool PrintFileName;
-enum radix { none, octal, hexadecimal, decimal };
+enum class encoding { s, S, u };
+static encoding Encoding;
+
+enum class radix { none, octal, hexadecimal, decimal };
----------------
hvdijk wrote:
My thinking here was:
1. `s`, `S`, `u` are too generic to be in the global namespace, therefore `encoding` needs to be an `enum class`.
2. `encoding` and `radix` are both enums in the same file used to represent option values, and it doesn't make sense for one to use `enum` and the other to use `enum class`.
If we accept both of these (which we don't necessarily do), `radix` needs to be an `enum class`. But we can avoid point 1 with your other comment of making the enumerator names not match the option values, I'll see if it's better that way.
https://github.com/llvm/llvm-project/pull/221794
More information about the llvm-commits
mailing list