================ @@ -435,14 +407,17 @@ class DefineOutline : public Tweak { if (MD->getParent()->isTemplated()) return false; - // The refactoring is meaningless for unnamed classes and definitions - // within unnamed namespaces. + // The refactoring is meaningless for unnamed classes. for (const DeclContext *DC = MD->getParent(); DC; DC = DC->getParent()) { if (auto *ND = llvm::dyn_cast<NamedDecl>(DC)) { - if (ND->getDeclName().isEmpty()) + if (ND->getDeclName().isEmpty() && + (!SameFile || !llvm::dyn_cast<NamespaceDecl>(ND))) return false; } } + } else if (SameFile) { ---------------- kadircet wrote:
nit: might be better to move this to the top, e.g: ``` auto *MD = dyn_cast...; if (!MD) return !SameFile; // Can't outline free-standing functions in the same file. // rest of the verification for methods ``` https://github.com/llvm/llvm-project/pull/69704 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits