diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Type.cpp | 27 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
3 files changed, 16 insertions, 19 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index d3639867450..e4688f09a32 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -138,8 +138,6 @@ static Optional<Visibility> getExplicitVisibility(const NamedDecl *D, return D->getExplicitVisibility((NamedDecl::ExplicitVisibilityKind) kind); } -typedef NamedDecl::LinkageInfo LinkageInfo; - /// Is the given declaration a "type" or a "value" for the purposes of /// visibility computation? static bool usesTypeVisibility(const NamedDecl *D) { diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index efd588a57a6..9ca48d53553 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -2002,20 +2002,19 @@ namespace { /// \brief The cached properties of a type. class CachedProperties { - NamedDecl::LinkageInfo LV; + LinkageInfo LV; bool local; - + public: - CachedProperties(NamedDecl::LinkageInfo LV, bool local) - : LV(LV), local(local) {} - + CachedProperties(LinkageInfo LV, bool local) : LV(LV), local(local) {} + Linkage getLinkage() const { return LV.linkage(); } Visibility getVisibility() const { return LV.visibility(); } bool isVisibilityExplicit() const { return LV.visibilityExplicit(); } bool hasLocalOrUnnamedType() const { return local; } - + friend CachedProperties merge(CachedProperties L, CachedProperties R) { - NamedDecl::LinkageInfo MergedLV = L.LV; + LinkageInfo MergedLV = L.LV; MergedLV.merge(R.LV); return CachedProperties(MergedLV, L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType()); @@ -2037,9 +2036,9 @@ public: static CachedProperties get(const Type *T) { ensure(T); - NamedDecl::LinkageInfo LV(T->TypeBits.getLinkage(), - T->TypeBits.getVisibility(), - T->TypeBits.isVisibilityExplicit()); + LinkageInfo LV(T->TypeBits.getLinkage(), + T->TypeBits.getVisibility(), + T->TypeBits.isVisibilityExplicit()); return CachedProperties(LV, T->TypeBits.hasLocalOrUnnamedType()); } @@ -2092,13 +2091,13 @@ static CachedProperties computeCachedProperties(const Type *T) { #include "clang/AST/TypeNodes.def" // Treat instantiation-dependent types as external. assert(T->isInstantiationDependentType()); - return CachedProperties(NamedDecl::LinkageInfo(), false); + return CachedProperties(LinkageInfo(), false); case Type::Builtin: // C++ [basic.link]p8: // A type is said to have linkage if and only if: // - it is a fundamental type (3.9.1); or - return CachedProperties(NamedDecl::LinkageInfo(), false); + return CachedProperties(LinkageInfo(), false); case Type::Record: case Type::Enum: { @@ -2108,7 +2107,7 @@ static CachedProperties computeCachedProperties(const Type *T) { // - it is a class or enumeration type that is named (or has a name // for linkage purposes (7.1.3)) and the name has linkage; or // - it is a specialization of a class template (14); or - NamedDecl::LinkageInfo LV = Tag->getLinkageAndVisibility(); + LinkageInfo LV = Tag->getLinkageAndVisibility(); bool IsLocalOrUnnamed = Tag->getDeclContext()->isFunctionOrMethod() || (!Tag->getIdentifier() && !Tag->getTypedefNameForAnonDecl()); @@ -2150,7 +2149,7 @@ static CachedProperties computeCachedProperties(const Type *T) { return result; } case Type::ObjCInterface: { - NamedDecl::LinkageInfo LV = + LinkageInfo LV = cast<ObjCInterfaceType>(T)->getDecl()->getLinkageAndVisibility(); return CachedProperties(LV, false); } diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 22aeee90875..cdb41a71e3b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -276,7 +276,7 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV, } // Set visibility for definitions. - NamedDecl::LinkageInfo LV = D->getLinkageAndVisibility(); + LinkageInfo LV = D->getLinkageAndVisibility(); if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage()) GV->setVisibility(GetLLVMVisibility(LV.visibility())); } @@ -693,7 +693,7 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, } else { F->setLinkage(llvm::Function::ExternalLinkage); - NamedDecl::LinkageInfo LV = FD->getLinkageAndVisibility(); + LinkageInfo LV = FD->getLinkageAndVisibility(); if (LV.linkage() == ExternalLinkage && LV.visibilityExplicit()) { F->setVisibility(GetLLVMVisibility(LV.visibility())); } @@ -1433,7 +1433,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, GV->setConstant(isTypeConstant(D->getType(), false)); // Set linkage and visibility in case we never see a definition. - NamedDecl::LinkageInfo LV = D->getLinkageAndVisibility(); + LinkageInfo LV = D->getLinkageAndVisibility(); if (LV.linkage() != ExternalLinkage) { // Don't set internal linkage on declarations. } else { |