summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-04-16 13:44:41 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-04-16 13:44:41 +0000
commit9d2874033d01573a6d736fa0ea4ec32aceb79acd (patch)
treef5882b411d9f68529c6fe4ca074613ce6a0f1398 /clang/lib/AST/Decl.cpp
parent750d040b7b1ec5b4cea6717158f5350a3a8b1396 (diff)
downloadbcm5719-llvm-9d2874033d01573a6d736fa0ea4ec32aceb79acd.tar.gz
bcm5719-llvm-9d2874033d01573a6d736fa0ea4ec32aceb79acd.zip
Add another constructor to LVFlags and use it to simplify the code a bit.
llvm-svn: 154814
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 7d608a3ba87..f26998081f8 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -78,24 +78,16 @@ struct LVFlags {
ConsiderTemplateParameterTypes(true) {
}
+ LVFlags(bool Global, bool Attributes, bool Parameters) :
+ ConsiderGlobalVisibility(Global),
+ ConsiderVisibilityAttributes(Attributes),
+ ConsiderTemplateParameterTypes(Parameters) {
+ }
+
/// \brief Returns a set of flags that is only useful for computing the
/// linkage, not the visibility, of a declaration.
static LVFlags CreateOnlyDeclLinkage() {
- LVFlags F;
- F.ConsiderGlobalVisibility = false;
- F.ConsiderVisibilityAttributes = false;
- F.ConsiderTemplateParameterTypes = false;
- return F;
- }
-
- /// Returns a set of flags, otherwise based on these, which ignores
- /// off all sources of visibility except template arguments.
- LVFlags onlyTemplateVisibility() const {
- LVFlags F = *this;
- F.ConsiderGlobalVisibility = false;
- F.ConsiderVisibilityAttributes = false;
- F.ConsiderTemplateParameterTypes = false;
- return F;
+ return LVFlags(false, false, false);
}
};
} // end anonymous namespace
@@ -391,7 +383,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
= Function->getTemplateSpecializationInfo()) {
if (shouldConsiderTemplateLV(Function, specInfo)) {
LV.merge(getLVForDecl(specInfo->getTemplate(),
- F.onlyTemplateVisibility()));
+ LVFlags::CreateOnlyDeclLinkage()));
const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;
LV.mergeWithMin(getLVForTemplateArgumentList(templateArgs, F));
}
@@ -415,7 +407,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
if (shouldConsiderTemplateLV(spec)) {
// From the template.
LV.merge(getLVForDecl(spec->getSpecializedTemplate(),
- F.onlyTemplateVisibility()));
+ LVFlags::CreateOnlyDeclLinkage()));
// The arguments at which the template was instantiated.
const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
@@ -514,7 +506,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) {
// Ignore both global visibility and attributes when computing our
// parent's visibility.
- ClassF = F.onlyTemplateVisibility();
+ ClassF = LVFlags::CreateOnlyDeclLinkage();
}
}
OpenPOWER on IntegriCloud