A decl never becomes unused. Make that explicit in the API.

llvm-svn: 193248
This commit is contained in:
Rafael Espindola 2013-10-23 16:46:34 +00:00
parent e7ae8af896
commit e4865d2836
4 changed files with 9 additions and 6 deletions

View File

@ -508,7 +508,7 @@ public:
/// \brief Set whether the declaration is used, in the sense of odr-use.
///
/// This should only be used immediately after creating a declaration.
void setIsUsed(bool U) { Used = U; }
void setIsUsed() { Used = true; }
/// \brief Mark the declaration used, in the sense of odr-use.
///

View File

@ -2801,7 +2801,8 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
New->setPure();
// Merge "used" flag.
New->setIsUsed(Old->getMostRecentDecl()->isUsed(false));
if (Old->getMostRecentDecl()->isUsed(false))
New->setIsUsed();
// Merge attributes from the parameters. These can mismatch with K&R
// declarations.
@ -3114,7 +3115,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
}
// Merge "used" flag.
New->setIsUsed(Old->getMostRecentDecl()->isUsed(false));
if (Old->getMostRecentDecl()->isUsed(false))
New->setIsUsed();
// Keep a chain of previous declarations.
New->setPreviousDecl(Old);

View File

@ -3378,7 +3378,8 @@ void Sema::BuildVariableInstantiation(
NewVar->setAccess(OldVar->getAccess());
if (!OldVar->isStaticDataMember()) {
NewVar->setIsUsed(OldVar->isUsed(false));
if (OldVar->isUsed(false))
NewVar->setIsUsed();
NewVar->setReferenced(OldVar->isReferenced());
}

View File

@ -386,7 +386,7 @@ void ASTDeclReader::VisitDecl(Decl *D) {
D->setAttrsImpl(Attrs, Reader.getContext());
}
D->setImplicit(Record[Idx++]);
D->setIsUsed(Record[Idx++]);
D->Used = Record[Idx++];
D->setReferenced(Record[Idx++]);
D->setTopLevelDeclInObjCContainer(Record[Idx++]);
D->setAccess((AccessSpecifier)Record[Idx++]);
@ -2989,7 +2989,7 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile,
case UPD_DECL_MARKED_USED: {
// FIXME: This doesn't send the right notifications if there are
// ASTMutationListeners other than an ASTWriter.
D->setIsUsed(true);
D->Used = true;
break;
}
}