================
@@ -642,9 +642,9 @@ bool SBDebugger::GetDefaultArchitecture(char *arch_name, 
size_t arch_name_len) {
     ArchSpec default_arch = Target::GetDefaultArchitecture();
 
     if (default_arch.IsValid()) {
-      const std::string &triple_str = default_arch.GetTriple().str();
+      const llvm::StringRef triple_str = default_arch.GetTriple().str(4);
----------------
dmpots wrote:

I think it would be good to add a couple of methods to `ArchSpec` so that we 
have a single place that specifies how we format the triple.

```
class ArchSpec {
    ...
    static std::string GetTripleStr(const llvm::Triple &triple) {
        return triple.normalize(CanonicalForm::FOUR_IDENT);
    }
    
    std::string GetTripleStr() {
        return GetTripleStr(GetTriple());
    }
};
```

Then if we have an `ArchSpec` we can just call the `GetTripleStr()` function on 
it and if we just have the `Triple` we can still use the static version.

https://github.com/llvm/llvm-project/pull/145157
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to