mizvekov added inline comments.

================
Comment at: clang/lib/Sema/SemaStmt.cpp:3314
+    return false;
+  const Decl *D = E.getReferencedDeclOfCallee();
+  if (!S.SourceMgr.isInSystemHeader(D->getLocation()))
----------------
aaron.ballman wrote:
> This can return `nullptr`, so we should probably return `false` in that case; 
> WDYT?
Yes I missed that, you are absolutely right!


================
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;
+  }
----------------
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.


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

Reply via email to