From 3060178ad9df29789505c1e6debcfc80a3a13587 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 17 Aug 2011 23:08:45 +0000 Subject: [PATCH] Fix else style. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137896 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 12 ++++-------- lib/AST/Decl.cpp | 6 ++---- lib/AST/DeclObjC.cpp | 3 +-- lib/Analysis/CFG.cpp | 3 +-- lib/Analysis/CocoaConventions.cpp | 3 +-- lib/Analysis/PrintfFormatString.cpp | 6 ++---- lib/Analysis/UninitializedValues.cpp | 6 ++---- lib/Driver/ArgList.cpp | 3 ++- lib/Driver/Driver.cpp | 3 ++- lib/Driver/Tools.cpp | 9 ++++----- 10 files changed, 21 insertions(+), 33 deletions(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 1740eed4e0..a731782a7a 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1116,8 +1116,7 @@ void ASTContext::DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, for (ObjCInterfaceDecl::ivar_iterator I = OI->ivar_begin(), E = OI->ivar_end(); I != E; ++I) Ivars.push_back(*I); - } - else { + } else { ObjCInterfaceDecl *IDecl = const_cast(OI); for (const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv; Iv= Iv->getNextIvar()) @@ -2762,8 +2761,7 @@ QualType ASTContext::getTypeOfExprType(Expr *tofExpr) const { // typeof(expr) type. Use that as our canonical type. toe = new (*this, TypeAlignment) TypeOfExprType(tofExpr, QualType((TypeOfExprType*)Canon, 0)); - } - else { + } else { // Build a new, canonical typeof(expr) type. Canon = new (*this, TypeAlignment) DependentTypeOfExprType(*this, tofExpr); @@ -2846,8 +2844,7 @@ QualType ASTContext::getDecltypeType(Expr *e) const { // decltype type. Use that as our canonical type. dt = new (*this, TypeAlignment) DecltypeType(e, DependentTy, QualType((DecltypeType*)Canon, 0)); - } - else { + } else { // Build a new, canonical typeof(expr) type. Canon = new (*this, TypeAlignment) DependentDecltypeType(*this, e); DependentDecltypeTypes.InsertNode(Canon, InsertPos); @@ -5246,8 +5243,7 @@ void getIntersectionOfProtocols(ASTContext &Context, for (unsigned i = 0; i < RHSNumProtocols; ++i) if (InheritedProtocolSet.count(RHSProtocols[i])) IntersectionOfProtocols.push_back(RHSProtocols[i]); - } - else { + } else { llvm::SmallPtrSet RHSInheritedProtocols; Context.CollectInheritedProtocols(RHS->getInterface(), RHSInheritedProtocols); diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index db7b570e05..b76d67bd81 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1003,8 +1003,7 @@ void DeclaratorDecl::setQualifierInfo(NestedNameSpecifierLoc QualifierLoc) { } // Set qualifier info. getExtInfo()->QualifierLoc = QualifierLoc; - } - else { + } else { // Here Qualifier == 0, i.e., we are removing the qualifier (if any). if (hasExtInfo()) { if (getExtInfo()->NumTemplParamLists == 0) { @@ -2290,8 +2289,7 @@ void TagDecl::setQualifierInfo(NestedNameSpecifierLoc QualifierLoc) { TypedefNameDeclOrQualifier = new (getASTContext()) ExtInfo; // Set qualifier info. getExtInfo()->QualifierLoc = QualifierLoc; - } - else { + } else { // Here Qualifier == 0, i.e., we are removing the qualifier (if any). if (hasExtInfo()) { if (getExtInfo()->NumTemplParamLists == 0) { diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index fd034d0eff..813501f1ac 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -758,8 +758,7 @@ ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCContainerDecl *DC, ID = IM->getClassInterface(); if (BW) IM->setHasSynthBitfield(true); - } - else { + } else { ObjCCategoryDecl *CD = cast(DC); ID = CD->getClassInterface(); if (BW) diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index a1997ab6a9..65dabda7e7 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -2203,8 +2203,7 @@ CFGBlock *CFGBuilder::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E, for (const VariableArrayType *VA =FindVA(E->getArgumentType().getTypePtr()); VA != 0; VA = FindVA(VA->getElementType().getTypePtr())) lastBlock = addStmt(VA->getSizeExpr()); - } - else { + } else { // For sizeof(x), where 'x' is a VLA, we should include the computation // of the lvalue of 'x'. Expr *subEx = E->getArgumentExpr(); diff --git a/lib/Analysis/CocoaConventions.cpp b/lib/Analysis/CocoaConventions.cpp index 176701a3ef..ea60f26e22 100644 --- a/lib/Analysis/CocoaConventions.cpp +++ b/lib/Analysis/CocoaConventions.cpp @@ -152,8 +152,7 @@ bool coreFoundation::followsCreateRule(StringRef functionName) { } else if (suffix.startswith("opy")) { it += 3; - } - else { + } else { // Keep scanning. continue; } diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 8b23a071d9..eb018f1eb5 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -38,8 +38,7 @@ static bool ParsePrecision(FormatStringHandler &H, PrintfSpecifier &FS, unsigned *argIndex) { if (argIndex) { FS.setPrecision(ParseNonPositionAmount(Beg, E, *argIndex)); - } - else { + } else { const OptionalAmount Amt = ParsePositionAmount(H, Start, Beg, E, analyze_format_string::PrecisionPos); if (Amt.isInvalid()) @@ -461,8 +460,7 @@ bool PrintfSpecifier::fixType(QualType QT) { CS.setKind(ConversionSpecifier::uArg); HasAlternativeForm = 0; HasPlusPrefix = 0; - } - else { + } else { assert(0 && "Unexpected type"); } diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 751258362a..84530227df 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -425,8 +425,7 @@ void TransferFunctions::VisitObjCForCollectionStmt(ObjCForCollectionStmt *fs) { vd = cast(ds->getSingleDecl()); if (!isTrackedVar(vd)) vd = 0; - } - else { + } else { // Initialize the value of the reference variable. const FindVarResult &res = findBlockVarDecl(cast(element)); vd = res.getDecl(); @@ -642,8 +641,7 @@ static bool runOnBlock(const CFGBlock *block, const CFG &cfg, vals.mergeIntoScratch(*(vB.second ? vB.second : vB.first), false); valsAB.first = vA.first; valsAB.second = &vals.getScratch(); - } - else { + } else { // Merge the 'T' bits from the first and second. assert(b->getOpcode() == BO_LOr); vals.mergeIntoScratch(*vA.first, true); diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp index c76356ca20..6f7cbb6062 100644 --- a/lib/Driver/ArgList.cpp +++ b/lib/Driver/ArgList.cpp @@ -51,8 +51,9 @@ void ArgList::eraseArg(OptSpecifier Id) { if ((*it)->getOption().matches(Id)) { it = Args.erase(it); ie = end(); - } else + } else { ++it; + } } } diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index ec6a07a54b..84321139ff 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -397,8 +397,9 @@ void Driver::generateCompilationDiagnostics(Compilation &C, if (types::getPreprocessedType(it->first) == types::TY_INVALID) { it = Inputs.erase(it); ie = Inputs.end(); - } else + } else { ++it; + } } if (Inputs.empty()) { Diag(clang::diag::note_drv_command_failed_diag_msg) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index f006c3b391..f6600ed1e4 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2438,11 +2438,10 @@ darwin::CC1::getDependencyFileName(const ArgList &Args, if (Arg *OutputOpt = Args.getLastArg(options::OPT_o)) { std::string Str(OutputOpt->getValue(Args)); - Res = Str.substr(0, Str.rfind('.')); - } else + } else { Res = darwin::CC1::getBaseInputStem(Args, Inputs); - + } return Args.MakeArgString(Res + ".d"); } @@ -2452,9 +2451,9 @@ void darwin::CC1::RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const { if (!strcmp(*it, "-Wno-self-assign")) { it = CmdArgs.erase(it); ie = CmdArgs.end(); - } - else + } else { ++it; + } } } -- 2.40.0