Revert "[AST] Pick last tentative definition as the acting definition"

This reverts commit 9a5f388850.

The written test breaks some builds on Mach-O.
This commit is contained in:
Benson Chu 2021-08-24 11:40:38 -05:00
parent de620f5b13
commit 1b19f90a23
2 changed files with 5 additions and 16 deletions

View File

@ -2216,18 +2216,14 @@ VarDecl *VarDecl::getActingDefinition() {
return nullptr;
VarDecl *LastTentative = nullptr;
// Loop through the declaration chain, starting with the most recent.
for (VarDecl *Decl = getMostRecentDecl(); Decl;
Decl = Decl->getPreviousDecl()) {
Kind = Decl->isThisDeclarationADefinition();
VarDecl *First = getFirstDecl();
for (auto I : First->redecls()) {
Kind = I->isThisDeclarationADefinition();
if (Kind == Definition)
return nullptr;
// Record the first (most recent) TentativeDefinition that is encountered.
if (Kind == TentativeDefinition && !LastTentative)
LastTentative = Decl;
if (Kind == TentativeDefinition)
LastTentative = I;
}
return LastTentative;
}

View File

@ -1,7 +0,0 @@
// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
char arr[10];
char arr[10] __attribute__((section("datadata")));
char arr[10] __attribute__((aligned(16)));
// CHECK: @arr ={{.*}}section "datadata", align 16