* Expand #X => "X" * @param output destination tokenlist * @param loc location for expanded token * @param tok The # token * @param expandedmacros set with expanded macros, with this macro * @param parametertokens parameters given when expanding this macro * @return token after the X */
| 2277 | * @return token after the X |
| 2278 | */ |
| 2279 | const Token *expandHash(TokenList &output, const Location &loc, const Token *tok, const std::set<TokenString> &expandedmacros, const std::vector<const Token*> ¶metertokens) const { |
| 2280 | TokenList tokenListHash(files); |
| 2281 | const MacroMap macros2; // temporarily bypass macro expansion |
| 2282 | tok = expandToken(tokenListHash, loc, tok->next, macros2, expandedmacros, parametertokens); |
| 2283 | std::ostringstream ostr; |
| 2284 | ostr << '\"'; |
| 2285 | for (const Token *hashtok = tokenListHash.cfront(), *next; hashtok; hashtok = next) { |
| 2286 | next = hashtok->next; |
| 2287 | ostr << hashtok->str(); |
| 2288 | if (next && hashtok->whitespaceahead) |
| 2289 | ostr << ' '; |
| 2290 | } |
| 2291 | ostr << '\"'; |
| 2292 | output.push_back(newMacroToken(escapeString(ostr.str()), loc, isReplaced(expandedmacros))); |
| 2293 | return tok; |
| 2294 | } |
| 2295 | |
| 2296 | /** |
| 2297 | * Expand A##B => AB |
nothing calls this directly
no test coverage detected