[clang] e1e74f6 - -Wmissing-prototypes: Don't warn in named namespaces nested in anonymous namespaces
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 4 10:09:38 PST 2022
Author: David Blaikie
Date: 2022-01-04T10:08:23-08:00
New Revision: e1e74f6cd6ce41ce8303a5a91f29736808fccc36
URL: https://github.com/llvm/llvm-project/commit/e1e74f6cd6ce41ce8303a5a91f29736808fccc36
DIFF: https://github.com/llvm/llvm-project/commit/e1e74f6cd6ce41ce8303a5a91f29736808fccc36.diff
LOG: -Wmissing-prototypes: Don't warn in named namespaces nested in anonymous namespaces
Added:
Modified:
clang/lib/AST/Decl.cpp
clang/test/SemaCXX/warn-missing-prototypes.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index e63560f1b6fea..3ef08cab96750 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3251,7 +3251,6 @@ bool FunctionDecl::isGlobal() const {
if (const auto *Namespace = cast<NamespaceDecl>(DC)) {
if (!Namespace->getDeclName())
return false;
- break;
}
}
diff --git a/clang/test/SemaCXX/warn-missing-prototypes.cpp b/clang/test/SemaCXX/warn-missing-prototypes.cpp
index bb71aa8b142d1..e8637e5a90eab 100644
--- a/clang/test/SemaCXX/warn-missing-prototypes.cpp
+++ b/clang/test/SemaCXX/warn-missing-prototypes.cpp
@@ -13,6 +13,10 @@ namespace NS {
namespace {
// Don't warn about functions in anonymous namespaces.
void f() { }
+ // Even if they're in nested namespaces within an anonymous namespace.
+ namespace NS {
+ void f() { }
+ }
}
struct A {
More information about the cfe-commits
mailing list