зеркало из https://github.com/microsoft/clang-1.git
Add a hasExternalStorageAsWritten helper. No functionality change.
It is possible that some of the current uses of "getStorageClassAsWritten() == SC_Extern" should use this but I don't know enough about SC_PrivateExtern to change and test them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
58bd77f613
Коммит
377830097a
|
@ -800,6 +800,13 @@ public:
|
|||
getStorageClass() == SC_PrivateExtern;
|
||||
}
|
||||
|
||||
/// hasExternalStorageAsWritten - Returns true if a variable was written
|
||||
/// with extern or __private_extern__ storage.
|
||||
bool hasExternalStorageAsWritten() const {
|
||||
return getStorageClassAsWritten() == SC_Extern ||
|
||||
getStorageClassAsWritten() == SC_PrivateExtern;
|
||||
}
|
||||
|
||||
/// hasGlobalStorage - Returns true for all variables that do not
|
||||
/// have local storage. This includs all global variables as well
|
||||
/// as static variables declared within a function.
|
||||
|
|
|
@ -1049,8 +1049,7 @@ static LinkageInfo getLVForLocalDecl(const NamedDecl *D,
|
|||
}
|
||||
|
||||
if (const VarDecl *Var = dyn_cast<VarDecl>(D)) {
|
||||
if (Var->getStorageClassAsWritten() == SC_Extern ||
|
||||
Var->getStorageClassAsWritten() == SC_PrivateExtern) {
|
||||
if (Var->hasExternalStorageAsWritten()) {
|
||||
if (Var->isInAnonymousNamespace() &&
|
||||
!Var->getDeclContext()->isExternCContext())
|
||||
return LinkageInfo::uniqueExternal();
|
||||
|
@ -1601,8 +1600,7 @@ VarDecl::DefinitionKind VarDecl::isThisDeclarationADefinition(
|
|||
if (hasExternalStorage())
|
||||
return DeclarationOnly;
|
||||
|
||||
if (getStorageClassAsWritten() == SC_Extern ||
|
||||
getStorageClassAsWritten() == SC_PrivateExtern) {
|
||||
if (hasExternalStorageAsWritten()) {
|
||||
for (const VarDecl *PrevVar = getPreviousDecl();
|
||||
PrevVar; PrevVar = PrevVar->getPreviousDecl()) {
|
||||
if (PrevVar->getLinkage() == InternalLinkage)
|
||||
|
|
Загрузка…
Ссылка в новой задаче