forked from OSchip/llvm-project
Don't walk a linked list twice in the same function. On my machine this takes
"clang -cc1" on a file with 10k repetitions of extern int no_such_variable; from 1.434s to 1.133s. llvm-svn: 168394
This commit is contained in:
parent
3a6808cc32
commit
cd7720a03f
|
@ -3299,10 +3299,10 @@ void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) {
|
|||
// Point to previous. Make sure that this is actually the most recent
|
||||
// redeclaration, or we can build invalid chains. If the most recent
|
||||
// redeclaration is invalid, it won't be PrevDecl, but we want it anyway.
|
||||
RedeclLink = PreviousDeclLink(
|
||||
llvm::cast<decl_type>(PrevDecl->getMostRecentDecl()));
|
||||
First = PrevDecl->getFirstDeclaration();
|
||||
assert(First->RedeclLink.NextIsLatest() && "Expected first");
|
||||
decl_type *MostRecent = First->RedeclLink.getNext();
|
||||
RedeclLink = PreviousDeclLink(llvm::cast<decl_type>(MostRecent));
|
||||
} else {
|
||||
// Make this first.
|
||||
First = static_cast<decl_type*>(this);
|
||||
|
|
Loading…
Reference in New Issue