================
@@ -1465,6 +1465,101 @@ bool 
DisassemblerLLVMC::MCDisasmInstance::IsAuthenticated(
   return InstrDesc.isAuthenticated() || IsBrkC47x;
 }
 
+static void
+UpdateSubtargetFeatures(const llvm::SubtargetFeatures &subtarget_features,
+                        std::string &user_feature_overrides) {
+
+  // Extract the default features string from the SubtargetFeatures object.
+  // We must store this in a std::string variable to ensure the memory exists
+  // for the StringRef to point to during the execution of this function.
+  std::string default_features_storage = subtarget_features.getString();
+  llvm::StringRef default_features = default_features_storage;
+
+  // If the user has not provided any overrides AND defaults exist,
+  // then simply use the default feature string.
+  if (user_feature_overrides.empty() && !default_features.empty()) {
+    user_feature_overrides = default_features.str();
+    return;
+  }
+
+  std::string warning_reason;
+  std::vector<std::string> valid_user_flags;
+  std::set<std::string> user_disabled_features;
+
+  for (llvm::StringRef flag : llvm::split(user_feature_overrides, ",")) {
+    bool is_valid = true;
+    flag = flag.trim();
+
+    // If we don't do this, flag.front() below will crash.
----------------
JDevlieghere wrote:

```suggestion
```

https://github.com/llvm/llvm-project/pull/147990
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to