forked from OSchip/llvm-project
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. llvm-svn: 176606
This commit is contained in:
parent
1e4272085d
commit
8f326a5a39
|
@ -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();
|
||||
|
@ -1600,9 +1599,8 @@ VarDecl::DefinitionKind VarDecl::isThisDeclarationADefinition(
|
|||
// AST for 'extern "C" int foo;' is annotated with 'extern'.
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue