[PATCH] D41566: [Modules TS] Diagnose exported internal linkage declarations

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 27 16:52:44 PDT 2018


rsmith added inline comments.


================
Comment at: include/clang/AST/DeclBase.h:2055-2075
+template<>
+struct GraphTraits<const ::clang::DeclContext *> {
+  using NodeRef = const ::clang::Decl *;
+  using ChildIteratorType = ::clang::DeclContext::decl_iterator;
+
+  static NodeRef getEntryNode(const ::clang::DeclContext *DC) {
+    return cast<::clang::Decl>(DC);
----------------
Neat :)


================
Comment at: lib/Sema/SemaDecl.cpp:16354
+    if (auto *DC = dyn_cast<DeclContext>(*It))
+      VisitChildren = DC->isLookupContext();
+
----------------
This will prematurely stop traversal if we reach a `LinkageSpecDecl`. I think we should instead stop if we reach a declaration for which `!DC->getRedeclContext()->isFileContext()` (that is, we should check namespace-scope declarations only).


https://reviews.llvm.org/D41566





More information about the cfe-commits mailing list