aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-10-09 23:42:09 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-10-09 23:42:09 +0000
commitb87720b77aee65e30a6181e239cbf708f4d29259 (patch)
tree5c9c3dc2f06f6e6a741f4833e2458858a1f57ad7 /clang/lib/AST/DeclBase.cpp
parent8b53f7ca6daa21ea4510c0d2b35bee7edade6b0e (diff)
downloadllvm-b87720b77aee65e30a6181e239cbf708f4d29259.zip
llvm-b87720b77aee65e30a6181e239cbf708f4d29259.tar.gz
llvm-b87720b77aee65e30a6181e239cbf708f4d29259.tar.bz2
[Modules TS] Module ownership semantics for redeclarations.
When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. llvm-svn: 315251
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 42f0ba0..1e15ee9 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -315,12 +315,11 @@ bool Decl::isLexicallyWithinFunctionOrMethod() const {
}
bool Decl::isInAnonymousNamespace() const {
- const DeclContext *DC = getDeclContext();
- do {
+ for (const DeclContext *DC = getDeclContext(); DC; DC = DC->getParent()) {
if (const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(DC))
if (ND->isAnonymousNamespace())
return true;
- } while ((DC = DC->getParent()));
+ }
return false;
}