MachineOperand* MO = ...; // Initialize a MachineOperand object StringRef SymbolName = MO->getSymbolName(); // Retrieve the symbol name
MachineOperand* MO = ...; // Initialize a MachineOperand object if (MO->isSymbol()) { assert(!MO->getSymbolName().empty() && "Symbol name is empty"); // Perform operations with the symbol name } else { // Perform operations without the symbol name }
void doSomethingWithSymbolName(StringRef SymbolName) { // Perform operations with the symbol name } MachineOperand* MO = ...; // Initialize a MachineOperand object if (MO->isSymbol()) { doSomethingWithSymbolName(MO->getSymbolName()); }In this example, a C++ function called doSomethingWithSymbolName() is defined to perform some operations with a string argument. The getSymbolName() method is called on the MO object to retrieve its symbol name, and then the doSomethingWithSymbolName() function is called with the symbol name as an argument. Package/library: LLVM