Remove trailing space

sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}

llvm-svn: 338291
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index 433e619..7e9bc6a 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -46,7 +46,7 @@
     CF_BRIDGING_ENABLE,
     CF_BRIDGING_MAY_INCLUDE
   };
-  
+
   void migrateDecl(Decl *D);
   void migrateObjCContainerDecl(ASTContext &Ctx, ObjCContainerDecl *D);
   void migrateProtocolConformance(ASTContext &Ctx,
@@ -63,26 +63,26 @@
   void migrateFactoryMethod(ASTContext &Ctx, ObjCContainerDecl *CDecl,
                             ObjCMethodDecl *OM,
                             ObjCInstanceTypeFamily OIT_Family = OIT_None);
-  
+
   void migrateCFAnnotation(ASTContext &Ctx, const Decl *Decl);
   void AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE,
                         const FunctionDecl *FuncDecl, bool ResultAnnotated);
   void AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE,
                         const ObjCMethodDecl *MethodDecl, bool ResultAnnotated);
-  
+
   void AnnotateImplicitBridging(ASTContext &Ctx);
-  
+
   CF_BRIDGING_KIND migrateAddFunctionAnnotation(ASTContext &Ctx,
                                                 const FunctionDecl *FuncDecl);
-  
+
   void migrateARCSafeAnnotation(ASTContext &Ctx, ObjCContainerDecl *CDecl);
-  
+
   void migrateAddMethodAnnotation(ASTContext &Ctx,
                                   const ObjCMethodDecl *MethodDecl);
 
   void inferDesignatedInitializers(ASTContext &Ctx,
                                    const ObjCImplementationDecl *ImplD);
-  
+
   bool InsertFoundation(ASTContext &Ctx, SourceLocation Loc);
 
 public:
@@ -225,7 +225,7 @@
              isa<ObjCIvarRefExpr>(Expr) || isa<ParenExpr>(FullExpr) ||
              isa<ParenListExpr>(Expr) || isa<SizeOfPackExpr>(Expr));
   }
-  
+
   /// - Rewrite message expression for Objective-C setter and getters into
   /// property-dot syntax.
   bool rewriteToPropertyDotSyntax(const ObjCMessageExpr *Msg,
@@ -239,17 +239,17 @@
     if (const Expr *Receiver = Msg->getInstanceReceiver())
       if (Receiver->getType()->isObjCBuiltinType())
         return false;
-      
+
     const ObjCMethodDecl *Method = Msg->getMethodDecl();
     if (!Method)
       return false;
     if (!Method->isPropertyAccessor())
       return false;
-    
+
     const ObjCPropertyDecl *Prop = Method->findPropertyDecl();
     if (!Prop)
       return false;
-    
+
     SourceRange MsgRange = Msg->getSourceRange();
     bool ReceiverIsSuper =
       (Msg->getReceiverKind() == ObjCMessageExpr::SuperInstance);
@@ -276,7 +276,7 @@
         PropertyDotString = ".";
       PropertyDotString += Prop->getName();
       commit.replace(SpaceRange, PropertyDotString);
-      
+
       // remove '[' ']'
       commit.replace(SourceRange(MsgRange.getBegin(), MsgRange.getBegin()), "");
       commit.replace(SourceRange(MsgRange.getEnd(), MsgRange.getEnd()), "");
@@ -465,7 +465,7 @@
     PropertyString += "(nonatomic";
     LParenAdded = true;
   }
-  
+
   std::string PropertyNameString = Getter->getNameAsString();
   StringRef PropertyName(PropertyNameString);
   if (LengthOfPrefix > 0) {
@@ -480,8 +480,8 @@
   // Property with no setter may be suggested as a 'readonly' property.
   if (!Setter)
     append_attr(PropertyString, "readonly", LParenAdded);
-  
-  
+
+
   // Short circuit 'delegate' properties that contain the name "delegate" or
   // "dataSource", or have exact name "target" to have 'assign' attribute.
   if (PropertyName.equals("target") ||
@@ -542,7 +542,7 @@
   }
   SourceLocation StartGetterSelectorLoc = Getter->getSelectorStartLoc();
   Selector GetterSelector = Getter->getSelector();
-  
+
   SourceLocation EndGetterSelectorLoc =
     StartGetterSelectorLoc.getLocWithOffset(GetterSelector.getNameForSlot(0).size());
   commit.replace(CharSourceRange::getCharRange(Getter->getLocStart(),
@@ -572,7 +572,7 @@
                                                       ObjCContainerDecl *D) {
   if (D->isDeprecated() || IsCategoryNameWithDeprecatedSuffix(D))
     return;
-    
+
   for (auto *Method : D->methods()) {
     if (Method->isDeprecated())
       continue;
@@ -587,7 +587,7 @@
   }
   if (!(ASTMigrateActions & FrontendOptions::ObjCMT_ReturnsInnerPointerProperty))
     return;
-  
+
   for (auto *Prop : D->instance_properties()) {
     if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) &&
         !Prop->isDeprecated())
@@ -628,7 +628,7 @@
       else
         return false;
     }
-  
+
   // At this point, all required properties in this protocol conform to those
   // declared in the class.
   // Check that class implements the required methods of the protocol too.
@@ -666,7 +666,7 @@
   std::string ClassString;
   SourceLocation EndLoc =
   IDecl->getSuperClass() ? IDecl->getSuperClassLoc() : IDecl->getLocation();
-  
+
   if (Protocols.empty()) {
     ClassString = '<';
     for (unsigned i = 0, e = ConformingProtocols.size(); i != e; i++) {
@@ -686,7 +686,7 @@
     ObjCInterfaceDecl::protocol_loc_iterator PL = IDecl->protocol_loc_end() - 1;
     EndLoc = *PL;
   }
-  
+
   commit.insertAfterToken(EndLoc, ClassString);
   return true;
 }
@@ -717,7 +717,7 @@
     ClassString += NSIntegerName;
   }
   ClassString += ", ";
-  
+
   ClassString += TypedefDcl->getIdentifier()->getName();
   ClassString += ')';
   SourceRange R(EnumDcl->getLocStart(), EnumDcl->getLocStart());
@@ -731,7 +731,7 @@
   }
   else
     return false;
-  
+
   SourceLocation EndTypedefDclLoc = TypedefDcl->getLocEnd();
   EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc,
                                                  NS.getASTContext(), /*IsDecl*/true);
@@ -763,13 +763,13 @@
   QualType DesignatedEnumType = EnumDcl->getIntegerType();
   assert(!DesignatedEnumType.isNull()
          && "rewriteToNSMacroDecl - underlying enum type is null");
-  
+
   PrintingPolicy Policy(Ctx.getPrintingPolicy());
   std::string TypeString = DesignatedEnumType.getAsString(Policy);
   std::string ClassString = IsNSIntegerType ? "NS_ENUM(" : "NS_OPTIONS(";
   ClassString += TypeString;
   ClassString += ", ";
-  
+
   ClassString += TypedefDcl->getIdentifier()->getName();
   ClassString += ") ";
   SourceLocation EndLoc = EnumDcl->getBraceRange().getBegin();
@@ -781,7 +781,7 @@
   SourceLocation StartTypedefLoc = EnumDcl->getLocEnd();
   StartTypedefLoc = StartTypedefLoc.getLocWithOffset(+1);
   SourceLocation EndTypedefLoc = TypedefDcl->getLocEnd();
-  
+
   commit.remove(SourceRange(StartTypedefLoc, EndTypedefLoc));
 }
 
@@ -801,7 +801,7 @@
     if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(InitExpr))
       if (BO->isShiftOp() || BO->isBitwiseOp())
         return true;
-    
+
     uint64_t EnumVal = Enumerator->getInitVal().getZExtValue();
     if (PowerOfTwo && EnumVal) {
       if (!llvm::isPowerOf2_64(EnumVal))
@@ -826,7 +826,7 @@
   return AllHexdecimalEnumerator || (PowerOfTwo && (MaxPowerOfTwoVal > 2));
 }
 
-void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,   
+void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,
                                             const ObjCImplementationDecl *ImpDecl) {
   const ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface();
   if (!IDecl || ObjCProtocolDecls.empty() || IDecl->isDeprecated())
@@ -836,11 +836,11 @@
   llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ExplicitProtocols;
   Ctx.CollectInheritedProtocols(IDecl, ExplicitProtocols);
   llvm::SmallVector<ObjCProtocolDecl *, 8> PotentialImplicitProtocols;
-  
+
   for (ObjCProtocolDecl *ProtDecl : ObjCProtocolDecls)
     if (!ExplicitProtocols.count(ProtDecl))
       PotentialImplicitProtocols.push_back(ProtDecl);
-  
+
   if (PotentialImplicitProtocols.empty())
     return;
 
@@ -852,10 +852,10 @@
     if (ClassImplementsAllMethodsAndProperties(Ctx, ImpDecl, IDecl,
                                               PotentialImplicitProtocols[i]))
       ConformingProtocols.push_back(PotentialImplicitProtocols[i]);
-  
+
   if (ConformingProtocols.empty())
     return;
-  
+
   // Further reduce number of conforming protocols. If protocol P1 is in the list
   // protocol P2 (P2<P1>), No need to include P1.
   llvm::SmallVector<ObjCProtocolDecl*, 8> MinimalConformingProtocols;
@@ -885,7 +885,7 @@
 
 void ObjCMigrateASTConsumer::CacheObjCNSIntegerTypedefed(
                                           const TypedefDecl *TypedefDcl) {
-  
+
   QualType qt = TypedefDcl->getTypeSourceInfo()->getType();
   if (NSAPIObj->isObjCNSIntegerType(qt))
     NSIntegerTypedefed = TypedefDcl;
@@ -919,10 +919,10 @@
   }
   if (TypedefDcl->isDeprecated())
     return false;
-  
+
   QualType qt = TypedefDcl->getTypeSourceInfo()->getType();
   StringRef NSIntegerName = NSAPIObj->GetNSIntegralKind(qt);
-  
+
   if (NSIntegerName.empty()) {
     // Also check for typedef enum {...} TD;
     if (const EnumType *EnumTy = qt->getAs<EnumType>()) {
@@ -938,7 +938,7 @@
     }
     return false;
   }
-  
+
   // We may still use NS_OPTIONS based on what we find in the enumertor list.
   bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
   if (!InsertFoundation(Ctx, TypedefDcl->getLocStart()))
@@ -1000,7 +1000,7 @@
                                                        ObjCMethodDecl *OM) {
   ObjCInstanceTypeFamily OIT_Family =
     Selector::getInstTypeMethodFamily(OM->getSelector());
-  
+
   std::string ClassName;
   switch (OIT_Family) {
     case OIT_None:
@@ -1025,7 +1025,7 @@
   }
   if (!OM->getReturnType()->isObjCIdType())
     return;
-  
+
   ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
   if (!IDecl) {
     if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(CDecl))
@@ -1080,7 +1080,7 @@
   if (!AA1)
     return true;
   const AvailabilityAttr *AA2 = dyn_cast<AvailabilityAttr>(At2);
-  
+
   VersionTuple Introduced1 = AA1->getIntroduced();
   VersionTuple Deprecated1 = AA1->getDeprecated();
   VersionTuple Obsoleted1 = AA1->getObsoleted();
@@ -1159,14 +1159,14 @@
   QualType GRT = Method->getReturnType();
   if (GRT->isVoidType())
     return false;
-  
+
   Selector GetterSelector = Method->getSelector();
   ObjCInstanceTypeFamily OIT_Family =
     Selector::getInstTypeMethodFamily(GetterSelector);
-  
+
   if (OIT_Family != OIT_None)
     return false;
-  
+
   IdentifierInfo *getterName = GetterSelector.getIdentifierInfoForSlot(0);
   Selector SetterSelector =
   SelectorTable::constructSetterSelector(PP.getIdentifierTable(),
@@ -1199,7 +1199,7 @@
       }
     }
   }
-  
+
   if (SetterMethod) {
     if ((ASTMigrateActions & FrontendOptions::ObjCMT_ReadwriteProperty) == 0)
       return false;
@@ -1207,7 +1207,7 @@
     if (SetterMethod->isDeprecated() ||
         !AttributesMatch(Method, SetterMethod, AvailabilityArgsMatch))
       return false;
-    
+
     // Is this a valid setter, matching the target getter?
     QualType SRT = SetterMethod->getReturnType();
     if (!SRT->isVoidType())
@@ -1255,7 +1255,7 @@
   if (!TypeIsInnerPointer(RT) ||
       !NSAPIObj->isMacroDefined("NS_RETURNS_INNER_POINTER"))
     return;
-  
+
   edit::Commit commit(*Editor);
   commit.insertBefore(OM->getLocEnd(), " NS_RETURNS_INNER_POINTER");
   Editor->commit(commit);
@@ -1277,7 +1277,7 @@
                                                  ObjCContainerDecl *CDecl) {
   if (CDecl->isDeprecated() || IsCategoryNameWithDeprecatedSuffix(CDecl))
     return;
-  
+
   // migrate methods which can have instancetype as their result type.
   for (auto *Method : CDecl->methods()) {
     if (Method->isDeprecated())
@@ -1294,7 +1294,7 @@
       OM->getReturnType() == Ctx.getObjCInstanceType() ||
       !OM->getReturnType()->isObjCIdType())
     return;
-  
+
   // Candidate factory methods are + (id) NaMeXXX : ... which belong to a class
   // NSYYYNamE with matching names be at least 3 characters long.
   ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
@@ -1306,17 +1306,17 @@
   }
   if (!IDecl)
     return;
-  
+
   std::string StringClassName = IDecl->getName();
   StringRef LoweredClassName(StringClassName);
   std::string StringLoweredClassName = LoweredClassName.lower();
   LoweredClassName = StringLoweredClassName;
-  
+
   IdentifierInfo *MethodIdName = OM->getSelector().getIdentifierInfoForSlot(0);
   // Handle method with no name at its first selector slot; e.g. + (id):(int)x.
   if (!MethodIdName)
     return;
-  
+
   std::string MethodName = MethodIdName->getName();
   if (OIT_Family == OIT_Singleton || OIT_Family == OIT_ReturnsSelf) {
     StringRef STRefMethodName(MethodName);
@@ -1353,10 +1353,10 @@
 static bool IsVoidStarType(QualType Ty) {
   if (!Ty->isPointerType())
     return false;
-  
+
   while (const TypedefType *TD = dyn_cast<TypedefType>(Ty.getTypePtr()))
     Ty = TD->getDecl()->getUnderlyingType();
-  
+
   // Is the type void*?
   const PointerType* PT = Ty->getAs<PointerType>();
   if (PT->getPointeeType().getUnqualifiedType()->isVoidType())
@@ -1418,14 +1418,14 @@
 void ObjCMigrateASTConsumer::migrateCFAnnotation(ASTContext &Ctx, const Decl *Decl) {
   if (Decl->isDeprecated())
     return;
-  
+
   if (Decl->hasAttr<CFAuditedTransferAttr>()) {
     assert(CFFunctionIBCandidates.empty() &&
            "Cannot have audited functions/methods inside user "
            "provided CF_IMPLICIT_BRIDGING_ENABLE");
     return;
   }
-  
+
   // Finction must be annotated first.
   if (const FunctionDecl *FuncDecl = dyn_cast<FunctionDecl>(Decl)) {
     CF_BRIDGING_KIND AuditKind = migrateAddFunctionAnnotation(Ctx, FuncDecl);
@@ -1469,7 +1469,7 @@
       if (Ret.isOwned() && NSAPIObj->isMacroDefined("NS_RETURNS_RETAINED"))
         AnnotationString = " NS_RETURNS_RETAINED";
     }
-    
+
     if (AnnotationString) {
       edit::Commit commit(*Editor);
       commit.insertAfterToken(FuncDecl->getLocEnd(), AnnotationString);
@@ -1503,18 +1503,18 @@
                                                   const FunctionDecl *FuncDecl) {
   if (FuncDecl->hasBody())
     return CF_BRIDGING_NONE;
-    
+
   CallEffects CE  = CallEffects::getEffect(FuncDecl);
   bool FuncIsReturnAnnotated = (FuncDecl->hasAttr<CFReturnsRetainedAttr>() ||
                                 FuncDecl->hasAttr<CFReturnsNotRetainedAttr>() ||
                                 FuncDecl->hasAttr<NSReturnsRetainedAttr>() ||
                                 FuncDecl->hasAttr<NSReturnsNotRetainedAttr>() ||
                                 FuncDecl->hasAttr<NSReturnsAutoreleasedAttr>());
-  
+
   // Trivial case of when function is annotated and has no argument.
   if (FuncIsReturnAnnotated && FuncDecl->getNumParams() == 0)
     return CF_BRIDGING_NONE;
-  
+
   bool ReturnCFAudited = false;
   if (!FuncIsReturnAnnotated) {
     RetEffect Ret = CE.getReturnValue();
@@ -1524,7 +1524,7 @@
     else if (!AuditedType(FuncDecl->getReturnType()))
       return CF_BRIDGING_NONE;
   }
-  
+
   // At this point result type is audited for potential inclusion.
   // Now, how about argument types.
   ArrayRef<ArgEffect> AEArgs = CE.getArgs();
@@ -1550,7 +1550,7 @@
   }
   if (ReturnCFAudited || ArgCFAudited)
     return CF_BRIDGING_ENABLE;
-  
+
   return CF_BRIDGING_MAY_INCLUDE;
 }
 
@@ -1558,7 +1558,7 @@
                                                  ObjCContainerDecl *CDecl) {
   if (!isa<ObjCInterfaceDecl>(CDecl) || CDecl->isDeprecated())
     return;
-  
+
   // migrate methods which can have instancetype as their result type.
   for (const auto *Method : CDecl->methods())
     migrateCFAnnotation(Ctx, Method);
@@ -1588,14 +1588,14 @@
         case clang::OMF_init:
         case clang::OMF_mutableCopy:
           break;
-          
+
         default:
           if (Ret.isOwned() && NSAPIObj->isMacroDefined("NS_RETURNS_RETAINED"))
             AnnotationString = " NS_RETURNS_RETAINED";
           break;
       }
     }
-    
+
     if (AnnotationString) {
       edit::Commit commit(*Editor);
       commit.insertBefore(MethodDecl->getLocEnd(), AnnotationString);
@@ -1622,7 +1622,7 @@
                                             const ObjCMethodDecl *MethodDecl) {
   if (MethodDecl->hasBody() || MethodDecl->isImplicit())
     return;
-  
+
   CallEffects CE  = CallEffects::getEffect(MethodDecl);
   bool MethodIsReturnAnnotated = (MethodDecl->hasAttr<CFReturnsRetainedAttr>() ||
                                   MethodDecl->hasAttr<CFReturnsNotRetainedAttr>() ||
@@ -1639,12 +1639,12 @@
     commit.insertBefore(MethodDecl->getLocEnd(), " NS_CONSUMES_SELF");
     Editor->commit(commit);
   }
-  
+
   // Trivial case of when function is annotated and has no argument.
   if (MethodIsReturnAnnotated &&
       (MethodDecl->param_begin() == MethodDecl->param_end()))
     return;
-  
+
   if (!MethodIsReturnAnnotated) {
     RetEffect Ret = CE.getReturnValue();
     if ((Ret.getObjKind() == RetEffect::CF ||
@@ -1655,7 +1655,7 @@
     } else if (!AuditedType(MethodDecl->getReturnType()))
       return;
   }
-  
+
   // At this point result type is either annotated or audited.
   // Now, how about argument types.
   ArrayRef<ArgEffect> AEArgs = CE.getArgs();
@@ -1811,7 +1811,7 @@
       OS.write_escaped(Text) << "\",\n";
     }
   };
- 
+
   void insert(SourceLocation Loc, StringRef Text) override {
     EntryWriter Writer(SourceMgr, OS);
     Writer.writeLoc(Loc);
@@ -1835,7 +1835,7 @@
 } // end anonymous namespace
 
 void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
-  
+
   TranslationUnitDecl *TU = Ctx.getTranslationUnitDecl();
   if (ASTMigrateActions & FrontendOptions::ObjCMT_MigrateDecls) {
     for (DeclContext::decl_iterator D = TU->decls_begin(), DEnd = TU->decls_end();
@@ -1846,7 +1846,7 @@
           if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
             AnnotateImplicitBridging(Ctx);
         }
-      
+
       if (ObjCInterfaceDecl *CDecl = dyn_cast<ObjCInterfaceDecl>(*D))
         if (canModify(CDecl))
           migrateObjCContainerDecl(Ctx, CDecl);
@@ -1911,7 +1911,7 @@
             canModify(FD))
           migrateCFAnnotation(Ctx, FD);
       }
-      
+
       if (ObjCContainerDecl *CDecl = dyn_cast<ObjCContainerDecl>(*D)) {
         bool CanModify = canModify(CDecl);
         // migrate methods which can have instancetype as their result type.
@@ -1934,7 +1934,7 @@
     if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
       AnnotateImplicitBridging(Ctx);
   }
-  
+
  if (IsOutputFile) {
    std::error_code EC;
    llvm::raw_fd_ostream OS(MigrateDir, EC, llvm::sys::fs::F_None);