[cfe-commits] r154814 - /cfe/trunk/lib/AST/Decl.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 16 06:44:41 PDT 2012
Author: rafael
Date: Mon Apr 16 08:44:41 2012
New Revision: 154814
URL: http://llvm.org/viewvc/llvm-project?rev=154814&view=rev
Log:
Add another constructor to LVFlags and use it to simplify the code a bit.
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=154814&r1=154813&r2=154814&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Apr 16 08:44:41 2012
@@ -78,24 +78,16 @@
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 @@
= 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 @@
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 @@
// Ignore both global visibility and attributes when computing our
// parent's visibility.
- ClassF = F.onlyTemplateVisibility();
+ ClassF = LVFlags::CreateOnlyDeclLinkage();
}
}
More information about the cfe-commits
mailing list