[llvm] [llvm-objcopy] Add llvm-objcopy option --set-visibility-sym (PR #80872)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 00:38:57 PST 2024


================
@@ -962,6 +977,34 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> RawArgsArr,
 
     Config.SymbolsToAdd.push_back(*SymInfo);
   }
+  for (auto *Arg : InputArgs.filtered(OBJCOPY_set_visibility_sym)) {
+    if (!StringRef(Arg->getValue()).contains('='))
+      return createStringError(errc::invalid_argument,
+                               "bad format for --set-visibility-sym");
+    auto SymAndVis = StringRef(Arg->getValue()).split('=');
+    Expected<uint8_t> Type = parseVisibilityType(SymAndVis.second);
+    if (!Type)
+      return Type.takeError();
+    ELFConfig.SetVisibilityType = Type.get();
----------------
jh7370 wrote:

`*Type` is more idiomatic than `Type.get()` when used with `Expected`

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


More information about the llvm-commits mailing list