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

via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 19:57:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Bill Wendling (bwendling)

<details>
<summary>Changes</summary>

Setting ValueStr allows us to query which option was selected.

---
Full diff: https://github.com/llvm/llvm-project/pull/90816.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/CommandLine.h (+1) 


``````````diff
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;
       }

``````````

</details>


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


More information about the llvm-commits mailing list