mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 06:56:06 +00:00
[modules] Set the lexical DC for dummy tag decls that refer to hidden
declarations that are made visible after the dummy is parsed and ODR verified Prior to this commit the "(getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one.")," assertion failure was triggered during semantic analysis of the dummy tag declaration that was declared in another tag declaration because its lexical context did not point to the outer tag decl. rdar://32292196 llvm-svn: 310706
This commit is contained in:
parent
45d2767ca7
commit
213d34330f
@ -13722,6 +13722,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
|
||||
// comparison.
|
||||
SkipBody->CheckSameAsPrevious = true;
|
||||
SkipBody->New = createTagFromNewDecl();
|
||||
SkipBody->New->setLexicalDeclContext(CurContext);
|
||||
SkipBody->Previous = Hidden;
|
||||
} else {
|
||||
SkipBody->ShouldSkip = true;
|
||||
|
6
clang/test/Modules/Inputs/innerstructredef.h
Normal file
6
clang/test/Modules/Inputs/innerstructredef.h
Normal file
@ -0,0 +1,6 @@
|
||||
struct Outer {
|
||||
// This definition is actually hidden since only submodule 'one' is imported.
|
||||
struct Inner {
|
||||
int x;
|
||||
} field;
|
||||
};
|
@ -451,3 +451,12 @@ module DebugNestedB {
|
||||
module objcAtKeywordMissingEnd {
|
||||
header "objcAtKeywordMissingEnd.h"
|
||||
}
|
||||
|
||||
module innerstructredef {
|
||||
module one {
|
||||
header "empty.h"
|
||||
}
|
||||
module two {
|
||||
header "innerstructredef.h"
|
||||
}
|
||||
}
|
||||
|
12
clang/test/Modules/inner-struct-redefines-invisible.m
Normal file
12
clang/test/Modules/inner-struct-redefines-invisible.m
Normal file
@ -0,0 +1,12 @@
|
||||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
@import innerstructredef.one;
|
||||
|
||||
struct Outer {
|
||||
// Should set lexical context when parsing 'Inner' here, otherwise there's a crash:
|
||||
struct Inner {
|
||||
int x;
|
||||
} field;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user