| 307 | } |
| 308 | |
| 309 | ASTDefNode *DebugInfoMap::updateArgMap(ASTNode &ACN, unsigned ArgNo) { |
| 310 | auto &U = ACN.getASTUnit(); |
| 311 | auto *E = const_cast<Expr *>(ACN.getNode().get<Expr>()); |
| 312 | assert(E && "Unexpected Program State"); |
| 313 | |
| 314 | auto Cur = getArgumentNode(*E, ArgNo, U); |
| 315 | assert(Cur && "Unexpected Program State"); |
| 316 | |
| 317 | // NOTE: This is not to insert argument location if previous or next argument |
| 318 | // have same location, which is one of the approaches to identify multiple |
| 319 | // arguments are in one macro like below. |
| 320 | // #define MACRO 0, 0 API(MACRO); |
| 321 | // So far, our algorithm can not change a token in a macro which has more than |
| 322 | // one tokens. |
| 323 | if (!Cur->getAssigned() || isArgsInMacro(*Cur, *E, ArgNo, U)) |
| 324 | Cur.reset(); |
| 325 | |
| 326 | ArgMapKey Key = {.E = E, .ArgNo = ArgNo}; |
| 327 | auto Result = ArgMap.emplace(Key, std::move(Cur)); |
| 328 | if (!Result.second) |
| 329 | return nullptr; |
| 330 | return Result.first->second.get(); |
| 331 | } |
| 332 | |
| 333 | void DebugInfoMap::updateCallMap(std::unique_ptr<ASTNode> Node) { |
| 334 | if (!Node || !Mapper) |
nothing calls this directly
no test coverage detected