MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / preprocessToken

Function preprocessToken

externals/simplecpp/simplecpp.cpp:3288–3314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3286}
3287
3288static bool preprocessToken(simplecpp::TokenList &output, const simplecpp::Token *&tok1, simplecpp::MacroMap &macros, std::vector<std::string> &files, simplecpp::OutputList *outputList)
3289{
3290 const simplecpp::Token * const tok = tok1;
3291 const simplecpp::MacroMap::const_iterator it = tok->name ? macros.find(tok->str()) : macros.end();
3292 if (it != macros.end()) {
3293 simplecpp::TokenList value(files);
3294 try {
3295 tok1 = it->second.expand(value, tok, macros, files);
3296 } catch (const simplecpp::Macro::Error &err) {
3297 if (outputList) {
3298 simplecpp::Output out{
3299 simplecpp::Output::SYNTAX_ERROR,
3300 err.location,
3301 "failed to expand \'" + tok->str() + "\', " + err.what
3302 };
3303 outputList->emplace_back(std::move(out));
3304 }
3305 return false;
3306 }
3307 output.takeTokens(value);
3308 } else {
3309 if (!tok->comment)
3310 output.push_back(new simplecpp::Token(*tok));
3311 tok1 = tok->next;
3312 }
3313 return true;
3314}
3315
3316static void getLocaltime(struct tm &ltime)
3317{

Callers 1

preprocessMethod · 0.85

Calls 5

expandMethod · 0.80
findMethod · 0.45
strMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected