Lines Matching +full:auto +full:- +full:string +full:- +full:detection

1 //===- CallGraph.cpp - AST-based Call graph -------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines the AST-based CallGraph.
11 //===----------------------------------------------------------------------===//
33 #include <string>
39 STATISTIC(NumObjCCallEdges, "Number of Objective-C method call edges");
56 if (FunctionDecl *CalleeDecl = CE->getDirectCallee()) in getDeclFromCall()
59 // Simple detection of a call through a block. in getDeclFromCall()
60 Expr *CEE = CE->getCallee()->IgnoreParenImpCasts(); in getDeclFromCall()
63 return Block->getBlockDecl(); in getDeclFromCall()
70 if (G->includeCalleeInGraph(D)) { in addCalledDecl()
71 CallGraphNode *CalleeNode = G->getOrInsertNode(D); in addCalledDecl()
72 CallerNode->addCallee({CalleeNode, CallExpr}); in addCalledDecl()
83 if (FunctionTemplateDecl *FTD = LE->getDependentCallOperator()) in VisitLambdaExpr()
84 for (FunctionDecl *FD : FTD->specializations()) in VisitLambdaExpr()
85 G->VisitFunctionDecl(FD); in VisitLambdaExpr()
86 else if (CXXMethodDecl *MD = LE->getCallOperator()) in VisitLambdaExpr()
87 G->VisitFunctionDecl(MD); in VisitLambdaExpr()
91 if (FunctionDecl *FD = E->getOperatorNew()) in VisitCXXNewExpr()
97 CXXConstructorDecl *Ctor = E->getConstructor(); in VisitCXXConstructExpr()
98 if (FunctionDecl *Def = Ctor->getDefinition()) in VisitCXXConstructExpr()
105 Visit(E->getExpr()); in VisitCXXDefaultArgExpr()
110 Visit(E->getExpr()); in VisitCXXDefaultInitExpr()
113 // Adds may-call edges for the ObjC message sends.
115 if (ObjCInterfaceDecl *IDecl = ME->getReceiverInterface()) { in VisitObjCMessageExpr()
116 Selector Sel = ME->getSelector(); in VisitObjCMessageExpr()
120 if (ME->isInstanceMessage()) in VisitObjCMessageExpr()
121 D = IDecl->lookupPrivateMethod(Sel); in VisitObjCMessageExpr()
123 D = IDecl->lookupPrivateClassMethod(Sel); in VisitObjCMessageExpr()
132 for (Stmt *SubStmt : S->children()) in VisitChildren()
134 this->Visit(SubStmt); in VisitChildren()
144 for (auto *I : D->decls()) in addNodesForBlocks()
145 if (auto *DC = dyn_cast<DeclContext>(I)) in addNodesForBlocks()
157 if (!D->hasBody()) in includeInGraph()
167 if (FD->isDependentContext()) in includeCalleeInGraph()
170 IdentifierInfo *II = FD->getIdentifier(); in includeCalleeInGraph()
171 if (II && II->getName().starts_with("__inline")) in includeCalleeInGraph()
186 if (Stmt *Body = D->getBody()) in addNodeForDecl()
190 if (auto constructor = dyn_cast<CXXConstructorDecl>(D)) { in addNodeForDecl()
191 for (CXXCtorInitializer *init : constructor->inits()) { in addNodeForDecl()
192 builder.Visit(init->getInit()); in addNodeForDecl()
200 return I->second.get(); in getNode()
205 F = F->getCanonicalDecl(); in getOrInsertNode()
214 Root->addCallee({Node.get(), /*Call=*/nullptr}); in getOrInsertNode()
219 OS << " --- Call graph Dump --- \n"; in print()
232 N->print(OS); in print()
235 for (CallGraphNode::const_iterator CI = N->begin(), in print()
236 CE = N->end(); CI != CE; ++CI) { in print()
237 assert(CI->Callee != Root && "No one can call the root node."); in print()
238 CI->Callee->print(OS); in print()
256 return ND->printQualifiedName(os); in print()
270 static std::string getNodeLabel(const CallGraphNode *Node, in getNodeLabel()
272 if (CG->getRoot() == Node) { in getNodeLabel()
275 if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(Node->getDecl())) in getNodeLabel()
276 return ND->getNameAsString(); in getNodeLabel()