checkDLLAttribute: remove a redundant dyn_cast
authorHans Wennborg <hans@hanshq.net>
Sat, 23 Aug 2014 21:10:39 +0000 (21:10 +0000)
committerHans Wennborg <hans@hanshq.net>
Sat, 23 Aug 2014 21:10:39 +0000 (21:10 +0000)
The same dyn_cast was done earlier in the function. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216326 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp

index ffec44243af100366268203f18e21a5e5acd47f6..844011880e4f5e916b6be8ee8163fe8056ef4b59 100644 (file)
@@ -4471,29 +4471,27 @@ static void checkDLLAttribute(Sema &S, CXXRecordDecl *Class) {
       Member->addAttr(NewAttr);
     }
 
-    if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(Member)) {
-      if (ClassExported) {
-        if (MD->isUserProvided()) {
-          // Instantiate non-default methods..
+    if (MD && ClassExported) {
+      if (MD->isUserProvided()) {
+        // Instantiate non-default methods..
 
-          // .. except for certain kinds of template specializations.
-          if (TSK == TSK_ExplicitInstantiationDeclaration)
-            continue;
-          if (TSK == TSK_ImplicitInstantiation && !ClassAttr->isInherited())
-            continue;
+        // .. except for certain kinds of template specializations.
+        if (TSK == TSK_ExplicitInstantiationDeclaration)
+          continue;
+        if (TSK == TSK_ImplicitInstantiation && !ClassAttr->isInherited())
+          continue;
 
-          S.MarkFunctionReferenced(Class->getLocation(), MD);
-        } else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() ||
-                   MD->isCopyAssignmentOperator() ||
-                   MD->isMoveAssignmentOperator()) {
-          // Instantiate non-trivial or explicitly defaulted methods, and the
-          // copy assignment / move assignment operators.
-          S.MarkFunctionReferenced(Class->getLocation(), MD);
-          // Resolve its exception specification; CodeGen needs it.
-          auto *FPT = MD->getType()->getAs<FunctionProtoType>();
-          S.ResolveExceptionSpec(Class->getLocation(), FPT);
-          S.ActOnFinishInlineMethodDef(MD);
-        }
+        S.MarkFunctionReferenced(Class->getLocation(), MD);
+      } else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() ||
+                 MD->isCopyAssignmentOperator() ||
+                 MD->isMoveAssignmentOperator()) {
+        // Instantiate non-trivial or explicitly defaulted methods, and the
+        // copy assignment / move assignment operators.
+        S.MarkFunctionReferenced(Class->getLocation(), MD);
+        // Resolve its exception specification; CodeGen needs it.
+        auto *FPT = MD->getType()->getAs<FunctionProtoType>();
+        S.ResolveExceptionSpec(Class->getLocation(), FPT);
+        S.ActOnFinishInlineMethodDef(MD);
       }
     }
   }