mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 02:26:09 +00:00
Add r168519 back, but with a fix to also merge the used flag in variables.
llvm-svn: 168564
This commit is contained in:
parent
48cf0dc360
commit
befe130dd2
@ -261,13 +261,6 @@ bool Decl::isUsed(bool CheckUsedAttr) const {
|
||||
if (CheckUsedAttr && hasAttr<UsedAttr>())
|
||||
return true;
|
||||
|
||||
// Check redeclarations. We merge attributes, so we don't need to check
|
||||
// attributes in all redeclarations.
|
||||
for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
|
||||
if (I->Used)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2388,6 +2388,10 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
|
||||
if (Old->isPure())
|
||||
New->setPure();
|
||||
|
||||
// Merge "used" flag.
|
||||
if (Old->isUsed(false))
|
||||
New->setUsed();
|
||||
|
||||
// Merge attributes from the parameters. These can mismatch with K&R
|
||||
// declarations.
|
||||
if (New->getNumParams() == Old->getNumParams())
|
||||
@ -2613,6 +2617,10 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
|
||||
New->getDeclContext() == Old->getDeclContext())
|
||||
New->setStorageClass(Old->getStorageClass());
|
||||
|
||||
// Merge "used" flag.
|
||||
if (Old->isUsed(false))
|
||||
New->setUsed();
|
||||
|
||||
// Keep a chain of previous declarations.
|
||||
New->setPreviousDeclaration(Old);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user