| 215 | } |
| 216 | |
| 217 | VarDecl *DebugInfoMap::getConstVarDecl(ASTDefNode &Node) const { |
| 218 | auto *Assigned = Node.getAssigned(); |
| 219 | if (!Assigned) |
| 220 | return nullptr; |
| 221 | |
| 222 | const auto *E = Assigned->getNode().get<Expr>(); |
| 223 | if (!E) |
| 224 | return nullptr; |
| 225 | |
| 226 | auto &Ctx = Assigned->getASTUnit().getASTContext(); |
| 227 | const VarDecl *Result = nullptr; |
| 228 | do { |
| 229 | if (E->IgnoreCasts()) |
| 230 | E = E->IgnoreCasts(); |
| 231 | |
| 232 | const auto *DRE = dyn_cast<DeclRefExpr>(E); |
| 233 | if (!DRE) |
| 234 | break; |
| 235 | |
| 236 | const auto *VD = DRE->getDecl(); |
| 237 | if (!VD) |
| 238 | break; |
| 239 | if (!VD->getType().isConstant(Ctx)) |
| 240 | return nullptr; |
| 241 | |
| 242 | Result = dyn_cast<VarDecl>(VD); |
| 243 | if (!Result) |
| 244 | return nullptr; |
| 245 | if (!Result->hasInit()) |
| 246 | return nullptr; |
| 247 | |
| 248 | E = Result->getInit(); |
| 249 | } while (E); |
| 250 | |
| 251 | return const_cast<VarDecl *>(Result); |
| 252 | } |
| 253 | |
| 254 | bool DebugInfoMap::isArgsInMacro(const ASTDefNode &Node, Expr &E, |
| 255 | unsigned ArgNo, ASTUnit &U) const { |
nothing calls this directly
no test coverage detected