> This is a fairly large block of code to further indent. Can you > move this to a helper function as a separate, preparatory patch > with no functionality change (NFC) that returns the new value of > `State`?
I’ve attached a patch which separates the state update logic in
checkForFunctionCall into a helper routine.
I’ll send a follow-up patch with the rest of the changes you requested shortly.
>> + // If the current state is FoundPathWithNoRecursiveCall, the
>> successors
>> + // will be either FoundPathWithNoRecursiveCall or FoundPath. To
>> determine
>> + // which, process all the Stmt's in this block to find any recursive
>> + // calls.
>> + for (const auto &B : CurBlock) {
>> + if (B.getKind() != CFGElement::Statement)
>> + continue;
>>
>> - const CallExpr *CE =
>> dyn_cast<CallExpr>(B.getAs<CFGStmt>()->getStmt());
>> - if (CE && CE->getCalleeDecl() &&
>> - CE->getCalleeDecl()->getCanonicalDecl() == FD) {
>> -
>> - // Skip function calls which are qualified with a templated class.
>> - if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(
>> - CE->getCallee()->IgnoreParenImpCasts())) {
>> - if (NestedNameSpecifier *NNS = DRE->getQualifier()) {
>> - if (NNS->getKind() == NestedNameSpecifier::TypeSpec &&
>> - isa<TemplateSpecializationType>(NNS->getAsType())) {
>> - continue;
>> + const CallExpr *CE =
>> dyn_cast<CallExpr>(B.getAs<CFGStmt>()->getStmt());
>> + if (CE && CE->getCalleeDecl() &&
>> + CE->getCalleeDecl()->getCanonicalDecl() == FD) {
>> +
>> + // Skip function calls which are qualified with a templated class.
>> + if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(
>> + CE->getCallee()->IgnoreParenImpCasts())) {
>> + if (NestedNameSpecifier *NNS = DRE->getQualifier()) {
>> + if (NNS->getKind() == NestedNameSpecifier::TypeSpec &&
>> + isa<TemplateSpecializationType>(NNS->getAsType())) {
>> + continue;
>> + }
>> }
>> }
>> - }
>>
>> - if (const CXXMemberCallExpr *MCE = dyn_cast<CXXMemberCallExpr>(CE))
>> {
>> - if (isa<CXXThisExpr>(MCE->getImplicitObjectArgument()) ||
>> - !MCE->getMethodDecl()->isVirtual()) {
>> - State = FoundPath;
>> + if (const CXXMemberCallExpr *MCE =
>> dyn_cast<CXXMemberCallExpr>(CE)) {
>> + if (isa<CXXThisExpr>(MCE->getImplicitObjectArgument()) ||
>> + !MCE->getMethodDecl()->isVirtual()) {
>> + CurState = FoundPath;
>> + break;
>> + }
>> + } else {
>> + CurState = FoundPath;
>> break;
>> }
>> - } else {
>> - State = FoundPath;
>> - break;
>> }
>> }
>> }
checkForFunctionCall-1.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
