r316539 - [Analyzer] Remove spaces inside comments mentioning the parameter name,

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 02:05:57 PDT 2017


Thanks! This should be enough for the tools, however I would also remove
all other spaces inside the argument comments for consistency with the rest
of LLVM code. Currently different ways of putting spaces inside the
argument comments are used in LLVM as follows:
  1. /*<space>Name<space>=<space>*/ - in 78 files (this is also
misunderstood by clang-format)
  2. /*<space>Name<space>=*/ - in 2 files
  3. /*<space>Name=*/ - in 3 files
  4. /*Name=*/ - in 693 files.

So #4 is clearly the prevalent style.

-- Alex

On Tue, Oct 24, 2017 at 5:03 PM, George Karpenkov via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: george.karpenkov
> Date: Tue Oct 24 17:03:45 2017
> New Revision: 316539
>
> URL: http://llvm.org/viewvc/llvm-project?rev=316539&view=rev
> Log:
> [Analyzer] Remove spaces inside comments mentioning the parameter name,
>
> to aid clang-tidy comprehension.
> Requested by @alexfh in https://reviews.llvm.org/D39015
>
> Modified:
>     cfe/trunk/lib/Analysis/BodyFarm.cpp
>
> Modified: cfe/trunk/lib/Analysis/BodyFarm.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
> Analysis/BodyFarm.cpp?rev=316539&r1=316538&r2=316539&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Analysis/BodyFarm.cpp (original)
> +++ cfe/trunk/lib/Analysis/BodyFarm.cpp Tue Oct 24 17:03:45 2017
> @@ -168,10 +168,10 @@ ASTMaker::makeLvalueToRvalue(const VarDe
>  ImplicitCastExpr *ASTMaker::makeImplicitCast(const Expr *Arg, QualType
> Ty,
>                                               CastKind CK) {
>    return ImplicitCastExpr::Create(C, Ty,
> -                                  /* CastKind= */ CK,
> -                                  /* Expr= */ const_cast<Expr *>(Arg),
> -                                  /* CXXCastPath= */ nullptr,
> -                                  /* ExprValueKind= */ VK_RValue);
> +                                  /* CastKind=*/ CK,
> +                                  /* Expr=*/ const_cast<Expr *>(Arg),
> +                                  /* CXXCastPath=*/ nullptr,
> +                                  /* ExprValueKind=*/ VK_RValue);
>  }
>
>  Expr *ASTMaker::makeIntegralCast(const Expr *Arg, QualType Ty) {
> @@ -222,7 +222,7 @@ MemberExpr *ASTMaker::makeMemberExpressi
>        C, base, IsArrow, SourceLocation(), NestedNameSpecifierLoc(),
>        SourceLocation(), MemberDecl, FoundDecl,
>        DeclarationNameInfo(MemberDecl->getDeclName(), SourceLocation()),
> -      /* TemplateArgumentListInfo= */ nullptr, MemberDecl->getType(),
> ValueKind,
> +      /* TemplateArgumentListInfo=*/ nullptr, MemberDecl->getType(),
> ValueKind,
>        OK_Ordinary);
>  }
>
> @@ -231,7 +231,7 @@ ValueDecl *ASTMaker::findMemberField(con
>    CXXBasePaths Paths(
>        /* FindAmbiguities=*/false,
>        /* RecordPaths=*/false,
> -      /* DetectVirtual= */ false);
> +      /* DetectVirtual=*/ false);
>    const IdentifierInfo &II = C.Idents.get(Name);
>    DeclarationName DeclName = C.DeclarationNames.getIdentifier(&II);
>
> @@ -282,14 +282,14 @@ static CallExpr *create_call_once_lambda
>    assert(callOperatorDecl != nullptr);
>
>    DeclRefExpr *callOperatorDeclRef =
> -      DeclRefExpr::Create(/* Ctx = */ C,
> -                          /* QualifierLoc = */ NestedNameSpecifierLoc(),
> -                          /* TemplateKWLoc = */ SourceLocation(),
> +      DeclRefExpr::Create(/* Ctx =*/ C,
> +                          /* QualifierLoc =*/ NestedNameSpecifierLoc(),
> +                          /* TemplateKWLoc =*/ SourceLocation(),
>                            const_cast<FunctionDecl *>(callOperatorDecl),
> -                          /* RefersToEnclosingVariableOrCapture= */
> false,
> -                          /* NameLoc = */ SourceLocation(),
> -                          /* T = */ callOperatorDecl->getType(),
> -                          /* VK = */ VK_LValue);
> +                          /* RefersToEnclosingVariableOrCapture=*/ false,
> +                          /* NameLoc =*/ SourceLocation(),
> +                          /* T =*/ callOperatorDecl->getType(),
> +                          /* VK =*/ VK_LValue);
>
>    return new (C)
>        CXXOperatorCallExpr(/*AstContext=*/C, OO_Call, callOperatorDeclRef,
> @@ -372,7 +372,7 @@ static Stmt *create_call_once(ASTContext
>      // Lambda requires callback itself inserted as a first parameter.
>      CallArgs.push_back(
>          M.makeDeclRefExpr(Callback,
> -                          /* RefersToEnclosingVariableOrCapture= */
> true));
> +                          /* RefersToEnclosingVariableOrCapture=*/
> true));
>      CallbackFunctionType = CallbackRecordDecl->getLambdaCallOperator()
>                                 ->getType()
>                                 ->getAs<FunctionProtoType>();
> @@ -429,13 +429,13 @@ static Stmt *create_call_once(ASTContext
>
>    // Negation predicate.
>    UnaryOperator *FlagCheck = new (C) UnaryOperator(
> -      /* input= */
> +      /* input=*/
>        M.makeImplicitCast(M.makeLvalueToRvalue(Deref, DerefType),
> DerefType,
>                           CK_IntegralToBoolean),
> -      /* opc= */ UO_LNot,
> -      /* QualType= */ C.IntTy,
> -      /* ExprValueKind= */ VK_RValue,
> -      /* ExprObjectKind= */ OK_Ordinary, SourceLocation());
> +      /* opc=*/ UO_LNot,
> +      /* QualType=*/ C.IntTy,
> +      /* ExprValueKind=*/ VK_RValue,
> +      /* ExprObjectKind=*/ OK_Ordinary, SourceLocation());
>
>    // Create assignment.
>    BinaryOperator *FlagAssignment = M.makeAssignment(
> @@ -443,11 +443,11 @@ static Stmt *create_call_once(ASTContext
>
>    IfStmt *Out = new (C)
>        IfStmt(C, SourceLocation(),
> -             /* IsConstexpr= */ false,
> -             /* init= */ nullptr,
> -             /* var= */ nullptr,
> -             /* cond= */ FlagCheck,
> -             /* then= */ M.makeCompound({CallbackCall, FlagAssignment}));
> +             /* IsConstexpr=*/ false,
> +             /* init=*/ nullptr,
> +             /* var=*/ nullptr,
> +             /* cond=*/ FlagCheck,
> +             /* then=*/ M.makeCompound({CallbackCall, FlagAssignment}));
>
>    return Out;
>  }
> @@ -522,19 +522,19 @@ static Stmt *create_dispatch_once(ASTCon
>      PredicateTy);
>
>    UnaryOperator *UO = new (C) UnaryOperator(
> -      /* input= */ LValToRval,
> -      /* opc= */ UO_LNot,
> -      /* QualType= */ C.IntTy,
> -      /* ExprValueKind= */ VK_RValue,
> -      /* ExprObjectKind= */ OK_Ordinary, SourceLocation());
> +      /* input=*/ LValToRval,
> +      /* opc=*/ UO_LNot,
> +      /* QualType=*/ C.IntTy,
> +      /* ExprValueKind=*/ VK_RValue,
> +      /* ExprObjectKind=*/ OK_Ordinary, SourceLocation());
>
>    // (5) Create the 'if' statement.
>    IfStmt *If = new (C) IfStmt(C, SourceLocation(),
> -                              /* IsConstexpr= */ false,
> -                              /* init= */ nullptr,
> -                              /* var= */ nullptr,
> -                              /* cond= */ UO,
> -                              /* then= */ CS);
> +                              /* IsConstexpr=*/ false,
> +                              /* init=*/ nullptr,
> +                              /* var=*/ nullptr,
> +                              /* cond=*/ UO,
> +                              /* then=*/ CS);
>    return If;
>  }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171025/e7d10cab/attachment.html>


More information about the cfe-commits mailing list