#ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
#define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
+#include <string>
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/SMLoc.h"
+
namespace llvm {
-class SMLoc;
class raw_ostream;
/// MCParsedAsmOperand - This abstract class represents a source-level assembly
/// MS-style inline assembly.
std::string Constraint;
+protected:
+ // This only seems to need to be movable (by ARMOperand) but ARMOperand has
+ // lots of members and MSVC doesn't support defaulted move ops, so to avoid
+ // that verbosity, just rely on defaulted copy ops. It's only the Constraint
+ // string member that would benefit from movement anyway.
+ MCParsedAsmOperand(const MCParsedAsmOperand &RHS) = default;
+ MCParsedAsmOperand &operator=(const MCParsedAsmOperand &) = default;
+ MCParsedAsmOperand() = default;
+
public:
- MCParsedAsmOperand() {}
virtual ~MCParsedAsmOperand() {}
void setConstraint(StringRef C) { Constraint = C.str(); }
void setMCOperandNum (unsigned OpNum) { MCOperandNum = OpNum; }
unsigned getMCOperandNum() { return MCOperandNum; }
- unsigned getNameLen() {
- assert (getStartLoc().isValid() && "Invalid StartLoc!");
- assert (getEndLoc().isValid() && "Invalid EndLoc!");
- return getEndLoc().getPointer() - getStartLoc().getPointer();
- }
-
- StringRef getName() {
- return StringRef(getStartLoc().getPointer(), getNameLen());
- }
+ virtual StringRef getSymName() { return StringRef(); }
+ virtual void *getOpDecl() { return nullptr; }
/// isToken - Is this a token operand?
virtual bool isToken() const = 0;
/// getEndLoc - Get the location of the last token of this operand.
virtual SMLoc getEndLoc() const = 0;
- /// needAsmRewrite - AsmRewrites happen in both the target-independent and
- /// target-dependent parsers. The target-independent parser calls this
- /// function to determine if the target-dependent parser has already taken
- /// care of the rewrites. Only valid when parsing MS-style inline assembly.
- virtual bool needAsmRewrite() const { return true; }
-
/// needAddressOf - Do we need to emit code to get the address of the
/// variable/label? Only valid when parsing MS-style inline assembly.
virtual bool needAddressOf() const { return false; }