forked from OSchip/llvm-project
Avoid walking all the declarations in the TU when a tag is declared in function
prototype scope in a function definition. llvm-svn: 256803
This commit is contained in:
parent
a694a0b141
commit
40b14d4893
|
@ -10911,12 +10911,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D,
|
||||||
// from the translation unit and reattach to the current context.
|
// from the translation unit and reattach to the current context.
|
||||||
if (D->getLexicalDeclContext() == Context.getTranslationUnitDecl()) {
|
if (D->getLexicalDeclContext() == Context.getTranslationUnitDecl()) {
|
||||||
// Is the decl actually in the context?
|
// Is the decl actually in the context?
|
||||||
for (const auto *DI : Context.getTranslationUnitDecl()->decls()) {
|
if (Context.getTranslationUnitDecl()->containsDecl(D))
|
||||||
if (DI == D) {
|
|
||||||
Context.getTranslationUnitDecl()->removeDecl(D);
|
Context.getTranslationUnitDecl()->removeDecl(D);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Either way, reassign the lexical decl context to our FunctionDecl.
|
// Either way, reassign the lexical decl context to our FunctionDecl.
|
||||||
D->setLexicalDeclContext(CurContext);
|
D->setLexicalDeclContext(CurContext);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue