[llvm] [CommandLine] Set the 'ValueStr' with the selected argument (PR #90816)

Bill Wendling via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 19:56:37 PDT 2024


https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/90816

Setting ValueStr allows us to query which option was selected.

>From 53791cd4be3e8e4b305a70e1a7b0760d912007b1 Mon Sep 17 00:00:00 2001
From: Bill Wendling <morbo at google.com>
Date: Wed, 1 May 2024 19:04:06 -0700
Subject: [PATCH] [CommandLine] Set the 'ValueStr' with the selected argument

Setting ValueStr allows us to query which option was selected.
---
 llvm/include/llvm/Support/CommandLine.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index b035209406b680..8acdd5b12efaec 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -865,6 +865,7 @@ template <class DataType> class parser : public generic_parser_base {
 
     for (size_t i = 0, e = Values.size(); i != e; ++i)
       if (Values[i].Name == ArgVal) {
+        O.setValueStr(Values[i].Name);
         V = Values[i].V.getValue();
         return false;
       }



More information about the llvm-commits mailing list