add a helper method for creating MCSymbol and MCSymbolRefExpr at

the same time.

llvm-svn: 81984
This commit is contained in:
Chris Lattner 2009-09-16 01:26:31 +00:00
parent b4bed3a497
commit 6a833f6806
2 changed files with 11 additions and 1 deletions

View File

@ -19,6 +19,7 @@ class MCContext;
class MCSymbol;
class MCValue;
class raw_ostream;
class StringRef;
/// MCExpr - Base class for the full range of assembler expressions which are
/// needed for parsing.
@ -119,7 +120,10 @@ public:
/// @{
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
/// @}
/// @name Accessors
/// @{

View File

@ -133,6 +133,12 @@ const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym,
return new (Ctx) MCSymbolRefExpr(Sym);
}
const MCSymbolRefExpr *MCSymbolRefExpr::Create(const StringRef &Name,
MCContext &Ctx) {
return Create(Ctx.GetOrCreateSymbol(Name), Ctx);
}
/* *** */
bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const {