LegalizeAdulthood updated this revision to Diff 38324.
LegalizeAdulthood added a comment.

Update from latest.
Update from comments.
I do not have commit access.


http://reviews.llvm.org/D10019

Files:
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaFixItUtils.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp

Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -214,15 +214,12 @@
   // array-to-pointer or function-to-pointer implicit conversions, so
   // check for their presence as well as checking whether FromType is
   // a pointer.
-  if (getToType(1)->isBooleanType() &&
-      (getFromType()->isPointerType() ||
-       getFromType()->isObjCObjectPointerType() ||
-       getFromType()->isBlockPointerType() ||
-       getFromType()->isNullPtrType() ||
-       First == ICK_Array_To_Pointer || First == ICK_Function_To_Pointer))
-    return true;
-
-  return false;
+  return getToType(1)->isBooleanType() &&
+         (getFromType()->isPointerType() ||
+          getFromType()->isObjCObjectPointerType() ||
+          getFromType()->isBlockPointerType() ||
+          getFromType()->isNullPtrType() || First == ICK_Array_To_Pointer ||
+          First == ICK_Function_To_Pointer);
 }
 
 /// isPointerConversionToVoidPointer - Determines whether this
@@ -1884,11 +1881,7 @@
 
   // An rvalue of type bool can be converted to an rvalue of type int,
   // with false becoming zero and true becoming one (C++ 4.5p4).
-  if (FromType->isBooleanType() && To->getKind() == BuiltinType::Int) {
-    return true;
-  }
-
-  return false;
+  return FromType->isBooleanType() && To->getKind() == BuiltinType::Int;
 }
 
 /// IsFloatingPointPromotion - Determines whether the conversion from
@@ -2806,11 +2799,8 @@
 static bool isNonTrivialObjCLifetimeConversion(Qualifiers FromQuals,
                                                Qualifiers ToQuals) {
   // Converting anything to const __unsafe_unretained is trivial.
-  if (ToQuals.hasConst() && 
-      ToQuals.getObjCLifetime() == Qualifiers::OCL_ExplicitNone)
-    return false;
-
-  return true;
+  return !(ToQuals.hasConst() &&
+           ToQuals.getObjCLifetime() == Qualifiers::OCL_ExplicitNone);
 }
 
 /// IsQualificationConversion - Determines whether the conversion from
Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6288,9 +6288,7 @@
         return true;
       DSAStackTy::DSAVarData DVarPrivate =
           Stack->hasDSA(VD, isOpenMPPrivate, MatchesAlways(), false);
-      if (DVarPrivate.CKind != OMPC_unknown)
-        return true;
-      return false;
+      return DVarPrivate.CKind != OMPC_unknown;
     }
     return false;
   }
Index: lib/Sema/SemaFixItUtils.cpp
===================================================================
--- lib/Sema/SemaFixItUtils.cpp
+++ lib/Sema/SemaFixItUtils.cpp
@@ -42,10 +42,8 @@
   const CanQualType FromUnq = From.getUnqualifiedType();
   const CanQualType ToUnq = To.getUnqualifiedType();
 
-  if ((FromUnq == ToUnq || (S.IsDerivedFrom(FromUnq, ToUnq)) ) &&
-      To.isAtLeastAsQualifiedAs(From))
-    return true;
-  return false;
+  return (FromUnq == ToUnq || (S.IsDerivedFrom(FromUnq, ToUnq))) &&
+         To.isAtLeastAsQualifiedAs(From);
 }
 
 bool ConversionFixItGenerator::tryToFixConversion(const Expr *FullExpr,
Index: lib/Sema/SemaExprCXX.cpp
===================================================================
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -2314,11 +2314,9 @@
       return true;
     }
 
-    if (CheckAllocationAccess(StartLoc, SourceRange(), Found.getNamingClass(),
-                              Matches[0], Diagnose) == AR_inaccessible)
-      return true;
-
-    return false;
+    return CheckAllocationAccess(StartLoc, SourceRange(),
+                                 Found.getNamingClass(), Matches[0],
+                                 Diagnose) == AR_inaccessible;
 
   // We found multiple suitable operators;  complain about the ambiguity.
   } else if (!Matches.empty()) {
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7716,9 +7716,7 @@
     return !S.getLangOpts().CPlusPlus;
   }
 
-  if (checkArithmeticIncompletePointerType(S, Loc, Operand)) return false;
-
-  return true;
+  return !checkArithmeticIncompletePointerType(S, Loc, Operand);
 }
 
 /// \brief Check the validity of a binary arithmetic operation w.r.t. pointer
@@ -8424,10 +8422,7 @@
     return false;
 
   QualType R = Method->getReturnType();
-  if (!R->isScalarType())
-    return false;
-
-  return true;
+  return R->isScalarType();
 }
 
 Sema::ObjCLiteralKind Sema::CheckLiteralKind(Expr *FromE) {
@@ -13765,11 +13760,8 @@
           << FD->getDeclName();
     }
   } Diagnoser(FD, CE);
-  
-  if (RequireCompleteType(Loc, ReturnType, Diagnoser))
-    return true;
 
-  return false;
+  return RequireCompleteType(Loc, ReturnType, Diagnoser);
 }
 
 // Diagnose the s/=/==/ and s/\|=/!=/ typos. Note that adding parentheses
Index: lib/Sema/SemaExceptionSpec.cpp
===================================================================
--- lib/Sema/SemaExceptionSpec.cpp
+++ lib/Sema/SemaExceptionSpec.cpp
@@ -110,13 +110,11 @@
   //   A type denoted in an exception-specification shall not denote a
   //   pointer or reference to an incomplete type, other than (cv) void* or a
   //   pointer or reference to a class currently being defined.
-  if (!(PointeeT->isRecordType() &&
-        PointeeT->getAs<RecordType>()->isBeingDefined()) &&
-      RequireCompleteType(Range.getBegin(), PointeeT,
-                          diag::err_incomplete_in_exception_spec, Kind, Range))
-    return true;
-
-  return false;
+  return !(PointeeT->isRecordType() &&
+           PointeeT->getAs<RecordType>()->isBeingDefined()) &&
+         RequireCompleteType(Range.getBegin(), PointeeT,
+                             diag::err_incomplete_in_exception_spec, Kind,
+                             Range);
 }
 
 /// CheckDistantExceptionSpec - Check if the given type is a pointer or pointer
Index: lib/Sema/SemaDeclObjC.cpp
===================================================================
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -1283,21 +1283,13 @@
         // Make sure the type is something we would accept as a type
         // argument.
         auto type = Context.getTypeDeclType(typeDecl);
-        if (type->isObjCObjectPointerType() ||
-            type->isBlockPointerType() ||
-            type->isDependentType() ||
-            type->isObjCObjectType())
-          return true;
-
-        return false;
+        return type->isObjCObjectPointerType() || type->isBlockPointerType() ||
+               type->isDependentType() || type->isObjCObjectType();
       }
 
       // If we have an Objective-C class type, accept it; there will
       // be another fix to add the '*'.
-      if (candidate.getCorrectionDeclAs<ObjCInterfaceDecl>())
-        return true;
-
-      return false;
+      return candidate.getCorrectionDeclAs<ObjCInterfaceDecl>() != nullptr;
     }
 
     return false;
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -849,10 +849,7 @@
   }
 
   // - each of its parameter types shall be a literal type;
-  if (!CheckConstexprParameterTypes(*this, NewFD))
-    return false;
-
-  return true;
+  return CheckConstexprParameterTypes(*this, NewFD);
 }
 
 /// Check the given declaration statement is legal within a constexpr function
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -364,10 +364,7 @@
 
   DeclContextLookupResult Res2 = RT->getDecl()->lookup(
       S.Context.DeclarationNames.getCXXOperatorName(OO_Arrow));
-  if (Res2.empty())
-    return false;
-
-  return true;
+  return !Res2.empty();
 }
 
 /// \brief Check if passed in Decl is a pointer type.
@@ -636,10 +633,7 @@
 
   // Check that all arguments are lockable objects.
   checkAttrArgsAreCapabilityObjs(S, D, Attr, Args);
-  if (Args.empty())
-    return false;
-
-  return true;
+  return !Args.empty();
 }
 
 static void handleAcquiredAfterAttr(Sema &S, Decl *D,
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -4677,13 +4677,11 @@
     // C++ constructors and destructors with incorrect scopes can break
     // our AST invariants by having the wrong underlying types. If
     // that's the case, then drop this declaration entirely.
-    if ((Name.getNameKind() == DeclarationName::CXXConstructorName ||
-         Name.getNameKind() == DeclarationName::CXXDestructorName) &&
-        !Context.hasSameType(Name.getCXXNameType(),
-                             Context.getTypeDeclType(cast<CXXRecordDecl>(Cur))))
-      return true;
-    
-    return false;
+    return (Name.getNameKind() == DeclarationName::CXXConstructorName ||
+            Name.getNameKind() == DeclarationName::CXXDestructorName) &&
+           !Context.hasSameType(
+               Name.getCXXNameType(),
+               Context.getTypeDeclType(cast<CXXRecordDecl>(Cur)));
   }
   
   // C++11 [dcl.meaning]p1:
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -4869,16 +4869,12 @@
                                              ObjCDeclSpec::DQ_PR_retain |
                                              ObjCDeclSpec::DQ_PR_strong |
                                              ObjCDeclSpec::DQ_PR_weak);
-  if (AssignCopyRetMask &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_assign &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_unsafe_unretained &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_copy &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_retain &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_strong &&
-      AssignCopyRetMask != ObjCDeclSpec::DQ_PR_weak)
-    return true;
-  
-  return false;
+  return AssignCopyRetMask && AssignCopyRetMask != ObjCDeclSpec::DQ_PR_assign &&
+         AssignCopyRetMask != ObjCDeclSpec::DQ_PR_unsafe_unretained &&
+         AssignCopyRetMask != ObjCDeclSpec::DQ_PR_copy &&
+         AssignCopyRetMask != ObjCDeclSpec::DQ_PR_retain &&
+         AssignCopyRetMask != ObjCDeclSpec::DQ_PR_strong &&
+         AssignCopyRetMask != ObjCDeclSpec::DQ_PR_weak;
 }
 
 void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) { 
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9117,11 +9117,8 @@
     RHS = cast->getSubExpr();
   }
 
-  if (LT == Qualifiers::OCL_Weak &&
-      checkUnsafeAssignLiteral(S, Loc, RHS, isProperty))
-    return true;
-
-  return false;
+  return LT == Qualifiers::OCL_Weak &&
+         checkUnsafeAssignLiteral(S, Loc, RHS, isProperty);
 }
 
 bool Sema::checkUnsafeAssigns(SourceLocation Loc,
@@ -9131,10 +9128,7 @@
   if (LT != Qualifiers::OCL_Weak && LT != Qualifiers::OCL_ExplicitNone)
     return false;
 
-  if (checkUnsafeAssignObject(*this, Loc, LT, RHS, false))
-    return true;
-
-  return false;
+  return checkUnsafeAssignObject(*this, Loc, LT, RHS, false);
 }
 
 void Sema::checkUnsafeExprAssigns(SourceLocation Loc,
@@ -9489,10 +9483,7 @@
     if (!isLayoutCompatible(C, *Field1, *Field2))
       return false;
   }
-  if (Field1 != Field1End || Field2 != Field2End)
-    return false;
-
-  return true;
+  return !(Field1 != Field1End || Field2 != Field2End);
 }
 
 /// \brief Check if two standard-layout unions are layout-compatible.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to