summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-09-30 19:12:29 +0000
committerErich Keane <erich.keane@intel.com>2019-09-30 19:12:29 +0000
commit5c2c60d2fc27e57c56674205faf95ecf01c1d4d9 (patch)
treeae5e9ff8790dee900b4ec2032fa5acc9f29c3816 /clang/lib/Analysis
parent3405237f77111946db90d986f2b5d9b9f8cae8a1 (diff)
downloadbcm5719-llvm-5c2c60d2fc27e57c56674205faf95ecf01c1d4d9.tar.gz
bcm5719-llvm-5c2c60d2fc27e57c56674205faf95ecf01c1d4d9.zip
Teach CallGraph to look into Generic Lambdas.
CallGraph visited LambdaExpr by getting the Call Operator from CXXRecordDecl (LambdaExpr::getCallOperator calls CXXRecordDecl::getLambdaCallOperator), which replaced generic lambda call operators with the non-instantiated FunctionDecl. The result was that the CallGraph would only pick up non-dependent calls. This patch does a few things: 1- Extend CXXRecordDecl to have a getDependentLambdaCallOperator, which will get the FunctionTemplateDecl, rather than immediately getting the TemplateDecl. 2- Define getLambdaCallOperator and getDependentLambdaCallOperator in terms of a common function. 3- Extend LambdaExpr with a getDependentCallOperator, which just calls the above function. 4- Changes CallGraph to handle Generic LambdaExprs. llvm-svn: 373247
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CallGraph.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index 865840eb341..76be292dad8 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/lib/Analysis/CallGraph.cpp
@@ -80,7 +80,10 @@ public:
}
void VisitLambdaExpr(LambdaExpr *LE) {
- if (CXXMethodDecl *MD = LE->getCallOperator())
+ if (FunctionTemplateDecl *FTD = LE->getDependentCallOperator())
+ for (FunctionDecl *FD : FTD->specializations())
+ G->VisitFunctionDecl(FD);
+ else if (CXXMethodDecl *MD = LE->getCallOperator())
G->VisitFunctionDecl(MD);
}
OpenPOWER on IntegriCloud