r214526 - Dropping some else-after-returns. No functional changes intended.

Aaron Ballman aaron at aaronballman.com
Fri Aug 1 10:02:34 PDT 2014


Author: aaronballman
Date: Fri Aug  1 12:02:34 2014
New Revision: 214526

URL: http://llvm.org/viewvc/llvm-project?rev=214526&view=rev
Log:
Dropping some else-after-returns. No functional changes intended.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=214526&r1=214525&r2=214526&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Aug  1 12:02:34 2014
@@ -91,9 +91,9 @@ static QualType getFunctionOrMethodParam
 static SourceRange getFunctionOrMethodParamRange(const Decl *D, unsigned Idx) {
   if (const auto *FD = dyn_cast<FunctionDecl>(D))
     return FD->getParamDecl(Idx)->getSourceRange();
-  else if (const auto *MD = dyn_cast<ObjCMethodDecl>(D))
+  if (const auto *MD = dyn_cast<ObjCMethodDecl>(D))
     return MD->parameters()[Idx]->getSourceRange();
-  else if (const auto *BD = dyn_cast<BlockDecl>(D))
+  if (const auto *BD = dyn_cast<BlockDecl>(D))
     return BD->getParamDecl(Idx)->getSourceRange();
   return SourceRange();
 }
@@ -107,7 +107,7 @@ static QualType getFunctionOrMethodResul
 static SourceRange getFunctionOrMethodResultSourceRange(const Decl *D) {
   if (const auto *FD = dyn_cast<FunctionDecl>(D))
     return FD->getReturnTypeSourceRange();
-  else if (const auto *MD = dyn_cast<ObjCMethodDecl>(D))
+  if (const auto *MD = dyn_cast<ObjCMethodDecl>(D))
     return MD->getReturnTypeSourceRange();
   return SourceRange();
 }
@@ -116,11 +116,11 @@ static bool isFunctionOrMethodVariadic(c
   if (const FunctionType *FnTy = D->getFunctionType()) {
     const FunctionProtoType *proto = cast<FunctionProtoType>(FnTy);
     return proto->isVariadic();
-  } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
-    return BD->isVariadic();
-  else {
-    return cast<ObjCMethodDecl>(D)->isVariadic();
   }
+  if (const BlockDecl *BD = dyn_cast<BlockDecl>(D))
+    return BD->isVariadic();
+
+  return cast<ObjCMethodDecl>(D)->isVariadic();
 }
 
 static bool isInstanceMethod(const Decl *D) {





More information about the cfe-commits mailing list