// This happens when we instantiate a class with a friend declaration or a
// function with a local extern declaration, for instance.
if (D->isOutOfLine()) {
- auto *NS = dyn_cast<NamespaceDecl>(D->getDeclContext()->getRedeclContext());
- // FIXME: Also update surrounding inline namespaces.
- if (NS && NS->isFromASTFile())
+ auto *DC = D->getDeclContext();
+ while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
+ if (!NS->isFromASTFile())
+ break;
Writer.AddUpdatedDeclContext(NS->getPrimaryContext());
+ if (!NS->isInlineNamespace())
+ break;
+ DC = NS->getParent();
+ }
}
}
header "cxx-inline-namespace.h"
}
+module cxx_inline_namespace_b {
+ header "cxx-inline-namespace-b.h"
+}
+
module cxx_linkage_cache {
header "cxx-linkage-cache.h"
}
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
@import cxx_inline_namespace;
+@import cxx_inline_namespace_b;
T x; // expected-error {{unknown type name 'T'}}
+
+X::Elaborated *p;