/// \brief Helper class for storing information about an active macro
/// instantiation.
struct MacroInstantiation {
- /// The macro instantiation with substitutions.
- MemoryBuffer *Instantiation;
-
/// The location of the instantiation.
SMLoc InstantiationLoc;
size_t CondStackDepth;
public:
- MacroInstantiation(SMLoc IL, int EB, SMLoc EL, MemoryBuffer *I,
+ MacroInstantiation(SMLoc IL, int EB, SMLoc EL, StringRef I,
size_t CondStackDepth);
};
}
MacroInstantiation::MacroInstantiation(SMLoc IL, int EB, SMLoc EL,
- MemoryBuffer *I, size_t CondStackDepth)
- : Instantiation(I), InstantiationLoc(IL), ExitBuffer(EB), ExitLoc(EL),
+ StringRef I, size_t CondStackDepth)
+ : InstantiationLoc(IL), ExitBuffer(EB), ExitLoc(EL),
CondStackDepth(CondStackDepth) {}
static bool isOperator(AsmToken::TokenKind kind) {
// instantiation stack.
MacroInstantiation *MI =
new MacroInstantiation(NameLoc, CurBuffer, getTok().getLoc(),
- Instantiation, TheCondStack.size());
+ Instantiation->getBuffer(), TheCondStack.size());
ActiveMacros.push_back(MI);
// Jump to the macro instantiation and prime the lexer.
- CurBuffer = SrcMgr.AddNewSourceBuffer(MI->Instantiation, SMLoc());
+ CurBuffer = SrcMgr.AddNewSourceBuffer(Instantiation, SMLoc());
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer());
Lex();
// instantiation stack.
MacroInstantiation *MI =
new MacroInstantiation(DirectiveLoc, CurBuffer, getTok().getLoc(),
- Instantiation, TheCondStack.size());
+ Instantiation->getBuffer(), TheCondStack.size());
ActiveMacros.push_back(MI);
// Jump to the macro instantiation and prime the lexer.
- CurBuffer = SrcMgr.AddNewSourceBuffer(MI->Instantiation, SMLoc());
+ CurBuffer = SrcMgr.AddNewSourceBuffer(Instantiation, SMLoc());
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer());
Lex();
}