llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Georgiy Samoylov (sga-sc)

<details>
<summary>Changes</summary>

At this moment feature string in `DisassemblerLLVMC` constructor for example 
for RISC-V architecture can be something like `+m,+f,+d,+a,+m,`. Last comma at 
this string is redundant judging by this comment 
https://github.com/llvm/llvm-project/blob/c9d065abc15846deb95a23fb0b3e1855d3d26314/llvm/include/llvm/TargetParser/SubtargetFeature.h#L167-L174

This patch is also needed for successful test passing in 
https://github.com/llvm/llvm-project/pull/180943

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


1 Files Affected:

- (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
(+6-2) 


``````````diff
diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index 6384b5e1bb57c..36329e40ab8a2 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1617,6 +1617,10 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec 
&arch,
     }
   }
 
+  // We should delete the last comma from string
+  if (!features_str.empty() && features_str.back() == ',')
+    features_str.pop_back();
+
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this
   // isn't good for some reason, we won't be valid and FindPlugin will fail and
   // we won't get used.
@@ -1638,9 +1642,9 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch,
     /* Create alternate disassembler for MIPS16 and microMIPS */
     uint32_t arch_flags = arch.GetFlags();
     if (arch_flags & ArchSpec::eMIPSAse_mips16)
-      features_str += "+mips16,";
+      features_str += ",+mips16";
     else if (arch_flags & ArchSpec::eMIPSAse_micromips)
-      features_str += "+micromips,";
+      features_str += ",+micromips";
 
     m_alternate_disasm_up = MCDisasmInstance::Create(
         triple_str, cpu, features_str.c_str(), flavor, *this);

``````````

</details>


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

Reply via email to