aaron.ballman added inline comments.
================ Comment at: clang/lib/Sema/SemaStmt.cpp:3317-3321 + for (const DeclContext *DC = D->getDeclContext(); DC; DC = DC->getParent()) { + if (const auto *NS = dyn_cast<NamespaceDecl>(DC)) + if (NS->isStdNamespace()) + return true; + } ---------------- mizvekov wrote: > aaron.ballman wrote: > > Can you use `D->isInStdNamespace()` instead? > It doesn't look like `isInStdNamespace` is equivalent here, even though the > name suggests otherwise. > This is a small helper, all it does is: > ``` > bool Decl::isInStdNamespace() const { > const DeclContext *DC = getDeclContext(); > return DC && DC->isStdNamespace(); > } > ``` > It helps you check `isStdNamespace` from a Decl, without having to through a > DeclContext yourself. > > Now if we really need this workaround to apply 'recursively' like this, that > is a different question which I am not sure. Good point -- `isInStdNamespace()` only looks if the declaration is in the `std` namespace, not whether any declaration context containing the declaration is in `std`. I don't have an issue with the current approach, was mostly thinking if there were ways to simplify it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105951/new/ https://reviews.llvm.org/D105951 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits