summaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 81cd1cc42658f..032a20afa8343 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -274,9 +274,17 @@ void Decl::setLexicalDeclContext(DeclContext *DC) {
} else {
getMultipleDC()->LexicalDC = DC;
}
- Hidden = cast<Decl>(DC)->Hidden;
- if (Hidden && !isFromASTFile() && hasLocalOwningModuleStorage())
- setLocalOwningModule(cast<Decl>(DC)->getOwningModule());
+
+ // FIXME: We shouldn't be changing the lexical context of declarations
+ // imported from AST files.
+ if (!isFromASTFile()) {
+ Hidden = cast<Decl>(DC)->Hidden && hasLocalOwningModuleStorage();
+ if (Hidden)
+ setLocalOwningModule(cast<Decl>(DC)->getOwningModule());
+ }
+
+ assert((!Hidden || getOwningModule()) &&
+ "hidden declaration has no owning module");
}
void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
@@ -440,8 +448,8 @@ const Attr *Decl::getDefiningAttr() const {
return nullptr;
}
-StringRef getRealizedPlatform(const AvailabilityAttr *A,
- const ASTContext &Context) {
+static StringRef getRealizedPlatform(const AvailabilityAttr *A,
+ const ASTContext &Context) {
// Check if this is an App Extension "platform", and if so chop off
// the suffix for matching with the actual platform.
StringRef RealizedPlatform = A->getPlatform()->getName();