[llvm] Add support for the .base64 directive (fixes #165499) (PR #165549)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 31 11:47:09 PDT 2025


================
@@ -3074,6 +3079,25 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
   return parseMany(parseOp);
 }
 
+/// parseDirectiveBase64:
+//    ::= .base64 "string"
+bool AsmParser::parseDirectiveBase64() {
+  if (checkForValidSection() ||
+      check(getTok().isNot(AsmToken::String), "expected string")) {
+    return true;
+  }
+
+  std::vector<char> Decoded;
+  std::string const str = getTok().getStringContents().str();
+  if (str.empty() || decodeBase64(str, Decoded)) {
+    return true;
+  }
----------------
lenary wrote:

Please can you test all your error cases?

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


More information about the llvm-commits mailing list