зеркало из https://github.com/microsoft/clang-1.git
Rename methods to comply with the LLVM Coding Standards.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
18895dc4fd
Коммит
f127eb8aeb
|
@ -216,7 +216,7 @@ public:
|
|||
|
||||
/// \brief Determines the visibility of this entity.
|
||||
Visibility getVisibility() const {
|
||||
return getLinkageAndVisibility().visibility();
|
||||
return getLinkageAndVisibility().getVisibility();
|
||||
}
|
||||
|
||||
/// \brief Determines the linkage and visibility of this entity.
|
||||
|
|
|
@ -1776,12 +1776,12 @@ public:
|
|||
|
||||
/// \brief Determine the visibility of this type.
|
||||
Visibility getVisibility() const {
|
||||
return getLinkageAndVisibility().visibility();
|
||||
return getLinkageAndVisibility().getVisibility();
|
||||
}
|
||||
|
||||
/// \brief Return true if the visibility was explicitly set is the code.
|
||||
bool isVisibilityExplicit() const {
|
||||
return getLinkageAndVisibility().visibilityExplicit();
|
||||
return getLinkageAndVisibility().isVisibilityExplicit();
|
||||
}
|
||||
|
||||
/// \brief Determine the linkage and visibility of this type.
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
explicit_(false) {}
|
||||
LinkageInfo(Linkage L, Visibility V, bool E)
|
||||
: linkage_(L), visibility_(V), explicit_(E) {
|
||||
assert(linkage() == L && visibility() == V && visibilityExplicit() == E &&
|
||||
"Enum truncated!");
|
||||
assert(getLinkage() == L && getVisibility() == V &&
|
||||
isVisibilityExplicit() == E && "Enum truncated!");
|
||||
}
|
||||
|
||||
static LinkageInfo external() {
|
||||
|
@ -76,22 +76,22 @@ public:
|
|||
return LinkageInfo(NoLinkage, DefaultVisibility, false);
|
||||
}
|
||||
|
||||
Linkage linkage() const { return (Linkage)linkage_; }
|
||||
Visibility visibility() const { return (Visibility)visibility_; }
|
||||
bool visibilityExplicit() const { return explicit_; }
|
||||
Linkage getLinkage() const { return (Linkage)linkage_; }
|
||||
Visibility getVisibility() const { return (Visibility)visibility_; }
|
||||
bool isVisibilityExplicit() const { return explicit_; }
|
||||
|
||||
void setLinkage(Linkage L) { linkage_ = L; }
|
||||
|
||||
void mergeLinkage(Linkage L) {
|
||||
setLinkage(minLinkage(linkage(), L));
|
||||
setLinkage(minLinkage(getLinkage(), L));
|
||||
}
|
||||
void mergeLinkage(LinkageInfo other) {
|
||||
mergeLinkage(other.linkage());
|
||||
mergeLinkage(other.getLinkage());
|
||||
}
|
||||
|
||||
/// Merge in the visibility 'newVis'.
|
||||
void mergeVisibility(Visibility newVis, bool newExplicit) {
|
||||
Visibility oldVis = visibility();
|
||||
Visibility oldVis = getVisibility();
|
||||
|
||||
// Never increase visibility.
|
||||
if (oldVis < newVis)
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
setVisibility(newVis, newExplicit);
|
||||
}
|
||||
void mergeVisibility(LinkageInfo other) {
|
||||
mergeVisibility(other.visibility(), other.visibilityExplicit());
|
||||
mergeVisibility(other.getVisibility(), other.isVisibilityExplicit());
|
||||
}
|
||||
|
||||
/// Merge both linkage and visibility.
|
||||
|
|
|
@ -574,7 +574,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
|
|||
}
|
||||
|
||||
// Add in global settings if the above didn't give us direct visibility.
|
||||
if (!LV.visibilityExplicit()) {
|
||||
if (!LV.isVisibilityExplicit()) {
|
||||
// Use global type/value visibility as appropriate.
|
||||
Visibility globalVisibility;
|
||||
if (computation == LVForValue) {
|
||||
|
@ -623,9 +623,9 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
|
|||
if (Context.getLangOpts().CPlusPlus &&
|
||||
!Var->getDeclContext()->isExternCContext()) {
|
||||
LinkageInfo TypeLV = Var->getType()->getLinkageAndVisibility();
|
||||
if (TypeLV.linkage() != ExternalLinkage)
|
||||
if (TypeLV.getLinkage() != ExternalLinkage)
|
||||
return LinkageInfo::uniqueExternal();
|
||||
if (!LV.visibilityExplicit())
|
||||
if (!LV.isVisibilityExplicit())
|
||||
LV.mergeVisibility(TypeLV);
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
|
|||
} else if (isa<EnumConstantDecl>(D)) {
|
||||
LinkageInfo EnumLV = getLVForDecl(cast<NamedDecl>(D->getDeclContext()),
|
||||
computation);
|
||||
if (!isExternalLinkage(EnumLV.linkage()))
|
||||
if (!isExternalLinkage(EnumLV.getLinkage()))
|
||||
return LinkageInfo::none();
|
||||
LV.merge(EnumLV);
|
||||
|
||||
|
@ -719,8 +719,8 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
|
|||
|
||||
// If we ended up with non-external linkage, visibility should
|
||||
// always be default.
|
||||
if (LV.linkage() != ExternalLinkage)
|
||||
return LinkageInfo(LV.linkage(), DefaultVisibility, false);
|
||||
if (LV.getLinkage() != ExternalLinkage)
|
||||
return LinkageInfo(LV.getLinkage(), DefaultVisibility, false);
|
||||
|
||||
return LV;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
|
|||
//
|
||||
// Note that we do this before merging information about
|
||||
// the class visibility.
|
||||
if (!LV.visibilityExplicit() && useInlineVisibilityHidden(D))
|
||||
if (!LV.isVisibilityExplicit() && useInlineVisibilityHidden(D))
|
||||
LV.mergeVisibility(HiddenVisibility, true);
|
||||
}
|
||||
|
||||
|
@ -756,16 +756,16 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
|
|||
// thing that can change its visibility is the template arguments, so
|
||||
// only look for them when processing the class.
|
||||
LVComputationKind classComputation = computation;
|
||||
if (LV.visibilityExplicit())
|
||||
if (LV.isVisibilityExplicit())
|
||||
classComputation = withExplicitVisibilityAlready(computation);
|
||||
|
||||
LinkageInfo classLV =
|
||||
getLVForDecl(cast<RecordDecl>(D->getDeclContext()), classComputation);
|
||||
if (!isExternalLinkage(classLV.linkage()))
|
||||
if (!isExternalLinkage(classLV.getLinkage()))
|
||||
return LinkageInfo::none();
|
||||
|
||||
// If the class already has unique-external linkage, we can't improve.
|
||||
if (classLV.linkage() == UniqueExternalLinkage)
|
||||
if (classLV.getLinkage() == UniqueExternalLinkage)
|
||||
return LinkageInfo::uniqueExternal();
|
||||
|
||||
// Otherwise, don't merge in classLV yet, because in certain cases
|
||||
|
@ -816,7 +816,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
|
|||
// type's visibility unless it's a definition.
|
||||
LinkageInfo typeLV = VD->getType()->getLinkageAndVisibility();
|
||||
LV.mergeMaybeWithVisibility(typeLV,
|
||||
!LV.visibilityExplicit() && !classLV.visibilityExplicit());
|
||||
!LV.isVisibilityExplicit() && !classLV.isVisibilityExplicit());
|
||||
|
||||
if (isExplicitMemberSpecialization(VD)) {
|
||||
explicitSpecSuppressor = VD;
|
||||
|
@ -825,8 +825,8 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
|
|||
// Template members.
|
||||
} else if (const TemplateDecl *temp = dyn_cast<TemplateDecl>(D)) {
|
||||
bool considerVisibility =
|
||||
(!LV.visibilityExplicit() &&
|
||||
!classLV.visibilityExplicit() &&
|
||||
(!LV.isVisibilityExplicit() &&
|
||||
!classLV.isVisibilityExplicit() &&
|
||||
!hasExplicitVisibilityAlready(computation));
|
||||
LinkageInfo tempLV =
|
||||
getLVForTemplateParameterList(temp->getTemplateParameters());
|
||||
|
@ -847,8 +847,9 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
|
|||
// an explicit attribute, ignore visibility from the parent.
|
||||
bool considerClassVisibility = true;
|
||||
if (explicitSpecSuppressor &&
|
||||
LV.visibilityExplicit() && // optimization: hasDVA() is true only if this
|
||||
classLV.visibility() != DefaultVisibility &&
|
||||
// optimization: hasDVA() is true only with explicit visibility.
|
||||
LV.isVisibilityExplicit() &&
|
||||
classLV.getVisibility() != DefaultVisibility &&
|
||||
hasDirectVisibilityAttribute(explicitSpecSuppressor, computation)) {
|
||||
considerClassVisibility = false;
|
||||
}
|
||||
|
@ -909,7 +910,7 @@ Linkage NamedDecl::getLinkage() const {
|
|||
|
||||
// We don't care about visibility here, so ask for the cheapest
|
||||
// possible visibility analysis.
|
||||
CachedLinkage = getLVForDecl(this, LVForExplicitValue).linkage();
|
||||
CachedLinkage = getLVForDecl(this, LVForExplicitValue).getLinkage();
|
||||
HasCachedLinkage = 1;
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -924,11 +925,11 @@ LinkageInfo NamedDecl::getLinkageAndVisibility() const {
|
|||
(usesTypeVisibility(this) ? LVForType : LVForValue);
|
||||
LinkageInfo LI = getLVForDecl(this, computation);
|
||||
if (HasCachedLinkage) {
|
||||
assert(Linkage(CachedLinkage) == LI.linkage());
|
||||
assert(Linkage(CachedLinkage) == LI.getLinkage());
|
||||
return LI;
|
||||
}
|
||||
HasCachedLinkage = 1;
|
||||
CachedLinkage = LI.linkage();
|
||||
CachedLinkage = LI.getLinkage();
|
||||
|
||||
#ifndef NDEBUG
|
||||
verifyLinkage();
|
||||
|
|
|
@ -2008,9 +2008,9 @@ class CachedProperties {
|
|||
public:
|
||||
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(); }
|
||||
Linkage getLinkage() const { return LV.getLinkage(); }
|
||||
Visibility getVisibility() const { return LV.getVisibility(); }
|
||||
bool isVisibilityExplicit() const { return LV.isVisibilityExplicit(); }
|
||||
bool hasLocalOrUnnamedType() const { return local; }
|
||||
|
||||
friend CachedProperties merge(CachedProperties L, CachedProperties R) {
|
||||
|
|
|
@ -277,8 +277,8 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
|
|||
|
||||
// Set visibility for definitions.
|
||||
LinkageInfo LV = D->getLinkageAndVisibility();
|
||||
if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage())
|
||||
GV->setVisibility(GetLLVMVisibility(LV.visibility()));
|
||||
if (LV.isVisibilityExplicit() || !GV->hasAvailableExternallyLinkage())
|
||||
GV->setVisibility(GetLLVMVisibility(LV.getVisibility()));
|
||||
}
|
||||
|
||||
static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel(StringRef S) {
|
||||
|
@ -694,8 +694,8 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD,
|
|||
F->setLinkage(llvm::Function::ExternalLinkage);
|
||||
|
||||
LinkageInfo LV = FD->getLinkageAndVisibility();
|
||||
if (LV.linkage() == ExternalLinkage && LV.visibilityExplicit()) {
|
||||
F->setVisibility(GetLLVMVisibility(LV.visibility()));
|
||||
if (LV.getLinkage() == ExternalLinkage && LV.isVisibilityExplicit()) {
|
||||
F->setVisibility(GetLLVMVisibility(LV.getVisibility()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
|
|||
|
||||
// Set linkage and visibility in case we never see a definition.
|
||||
LinkageInfo LV = D->getLinkageAndVisibility();
|
||||
if (LV.linkage() != ExternalLinkage) {
|
||||
if (LV.getLinkage() != ExternalLinkage) {
|
||||
// Don't set internal linkage on declarations.
|
||||
} else {
|
||||
if (D->hasAttr<DLLImportAttr>())
|
||||
|
@ -1443,8 +1443,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
|
|||
GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage);
|
||||
|
||||
// Set visibility on a declaration only if it's explicit.
|
||||
if (LV.visibilityExplicit())
|
||||
GV->setVisibility(GetLLVMVisibility(LV.visibility()));
|
||||
if (LV.isVisibilityExplicit())
|
||||
GV->setVisibility(GetLLVMVisibility(LV.getVisibility()));
|
||||
}
|
||||
|
||||
if (D->isThreadSpecified())
|
||||
|
|
Загрузка…
Ссылка в новой задаче