MCSymbol *symbol = ...; // get symbol from some source std::string name = symbol->getName(); std::cout << "Symbol name: " << name << std::endl;
llvm::MCContext *context = ...; // get context from some source MCSymbol *symbol = context->getOrCreateSymbol("my_symbol"); std::string name = symbol->getName(); std::cout << "Symbol name: " << name << std::endl;This code creates a new symbol with the name "my_symbol" using the llvm::MCContext class, and then calls the getName method on the symbol to obtain its name as a string. It then prints the symbol name to standard output. Package library: LLVM.