Lines Matching refs:macro

86 	for (auto macro : mExpander->mMacrosToReenable)  in ~ScopedMacroReenabler()  local
90 assert(macro->name.substr() != ""); in ~ScopedMacroReenabler()
91 macro->disabled = false; in ~ScopedMacroReenabler()
177 std::shared_ptr<Macro> macro = iter->second; in lex() local
178 if (macro->disabled) in lex()
187 macro->expansionCount++; in lex()
188 if ((macro->type == Macro::kTypeFunc) && !isNextTokenLeftParen()) in lex()
192 macro->expansionCount--; in lex()
196 pushMacro(macro, *token); in lex()
252 bool MacroExpander::pushMacro(std::shared_ptr<Macro> macro, const Token &identifier) in pushMacro() argument
254 assert(!macro->disabled); in pushMacro()
257 assert(identifier.text == macro->name); in pushMacro()
260 if (!expandMacro(*macro, identifier, &replacements)) in pushMacro()
264 macro->disabled = true; in pushMacro()
267 context->macro = macro; in pushMacro()
282 assert(context->macro->disabled); in popMacro()
283 assert(context->macro->expansionCount > 0); in popMacro()
286 mMacrosToReenable.push_back(context->macro); in popMacro()
290 context->macro->disabled = false; in popMacro()
292 context->macro->expansionCount--; in popMacro()
297 bool MacroExpander::expandMacro(const Macro &macro, in expandMacro() argument
308 if (macro.type == Macro::kTypeObj) in expandMacro()
310 replacements->assign(macro.replacements.begin(), macro.replacements.end()); in expandMacro()
312 if (macro.predefined) in expandMacro()
319 if (macro.name == kLine) in expandMacro()
323 else if (macro.name == kFile) in expandMacro()
331 assert(macro.type == Macro::kTypeFunc); in expandMacro()
333 args.reserve(macro.parameters.size()); in expandMacro()
334 if (!collectMacroArgs(macro, identifier, &args, &replacementLocation)) in expandMacro()
337 replaceMacroParams(macro, args, replacements); in expandMacro()
355 bool MacroExpander::collectMacroArgs(const Macro &macro, in collectMacroArgs() argument
419 const Macro::Parameters &params = macro.parameters; in collectMacroArgs()
428 Diagnostics::ID id = args->size() < macro.parameters.size() ? in collectMacroArgs()
467 void MacroExpander::replaceMacroParams(const Macro &macro, in replaceMacroParams() argument
471 for (std::size_t i = 0; i < macro.replacements.size(); ++i) in replaceMacroParams()
481 const Token &repl = macro.replacements[i]; in replaceMacroParams()
492 std::find(macro.parameters.begin(), macro.parameters.end(), repl.text); in replaceMacroParams()
493 if (iter == macro.parameters.end()) in replaceMacroParams()
499 std::size_t iArg = std::distance(macro.parameters.begin(), iter); in replaceMacroParams()
513 MacroExpander::MacroContext::MacroContext() : macro(0), index(0) in MacroContext()