[AST] hasAttr followed by getAttr isn't efficient

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

llvm-svn: 237336
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 173e22f..5d5ef96 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1915,10 +1915,13 @@
   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.