forked from OSchip/llvm-project
[modules] When reparenting a local declaration, don't mark the declaration as
being visible with its owning module if we're not tracking owning modules for local declarations. This avoids the possibility of a declaration being (meaninglessly) marked as hidden with no owning module, which would otherwise lead to violated AST invariants (checked by the added assertion). llvm-svn: 303699
This commit is contained in:
parent
9017ca290a
commit
ae50c56d65
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue