[AST] hasAttr followed by getAttr isn't efficient

Just use getAttr because we are interested in the attribute's contents.

llvm-svn: 237336
This commit is contained in:
David Majnemer 2015-05-14 05:19:20 +00:00
parent 87b853c5f0
commit dd0bed1b2d

View File

@ -1915,10 +1915,13 @@ VarDecl::isThisDeclarationADefinition(ASTContext &C) const {
if (hasInit())
return Definition;
if (hasAttr<AliasAttr>() ||
(hasAttr<SelectAnyAttr>() && !getAttr<SelectAnyAttr>()->isInherited()))
if (hasAttr<AliasAttr>())
return Definition;
if (const auto *SAA = getAttr<SelectAnyAttr>())
if (!SAA->isInherited())
return Definition;
// A variable template specialization (other than a static data member
// template or an explicit specialization) is a declaration until we
// instantiate its initializer.