@@ -1443,17 +1443,8 @@ void LifetimeCheckPass::checkPointerDeref(mlir::Value addr, mlir::Location loc,
1443
1443
emitPsetRemark ();
1444
1444
}
1445
1445
1446
- static FuncOp getCalleeFromSymbol (ModuleOp mod, llvm::StringRef name) {
1447
- auto global = mlir::SymbolTable::lookupSymbolIn (mod, name);
1448
- assert (global && " expected to find symbol for function" );
1449
- return dyn_cast<FuncOp>(global);
1450
- }
1451
-
1452
1446
static const ASTCXXMethodDeclInterface getMethod (ModuleOp mod, CallOp callOp) {
1453
- if (!callOp.getCallee ())
1454
- return nullptr ;
1455
- llvm::StringRef name = *callOp.getCallee ();
1456
- auto method = getCalleeFromSymbol (mod, name);
1447
+ auto method = callOp.getDirectCallee (mod);
1457
1448
if (!method || method.getBuiltin ())
1458
1449
return nullptr ;
1459
1450
return dyn_cast<ASTCXXMethodDeclInterface>(method.getAstAttr ());
@@ -1756,12 +1747,10 @@ bool LifetimeCheckPass::isTaskType(mlir::Value taskVal) {
1756
1747
}
1757
1748
1758
1749
void LifetimeCheckPass::trackCallToCoroutine (CallOp callOp) {
1759
- if (auto fnName = callOp.getCallee ()) {
1760
- auto calleeFuncOp = getCalleeFromSymbol (theModule, *fnName);
1761
- if (calleeFuncOp &&
1762
- (calleeFuncOp.getCoroutine () ||
1763
- (calleeFuncOp.isDeclaration () && callOp->getNumResults () > 0 &&
1764
- isTaskType (callOp->getResult (0 ))))) {
1750
+ if (auto calleeFuncOp = callOp.getDirectCallee (theModule)) {
1751
+ if (calleeFuncOp.getCoroutine () ||
1752
+ (calleeFuncOp.isDeclaration () && callOp->getNumResults () > 0 &&
1753
+ isTaskType (callOp->getResult (0 )))) {
1765
1754
currScope->localTempTasks .insert (callOp->getResult (0 ));
1766
1755
}
1767
1756
return ;
@@ -1792,13 +1781,11 @@ void LifetimeCheckPass::checkCall(CallOp callOp) {
1792
1781
1793
1782
// From this point on only owner and pointer class methods handling,
1794
1783
// starting from special methods.
1795
- if (auto fnName = callOp.getCallee ()) {
1796
- auto calleeFuncOp = getCalleeFromSymbol (theModule, *fnName);
1797
- if (calleeFuncOp && calleeFuncOp.getCxxSpecialMember ())
1798
- if (auto cxxCtor =
1799
- dyn_cast<cir::CXXCtorAttr>(*calleeFuncOp.getCxxSpecialMember ()))
1800
- return checkCtor (callOp, cxxCtor);
1801
- }
1784
+ auto calleeFuncOp = callOp.getDirectCallee (theModule);
1785
+ if (calleeFuncOp && calleeFuncOp.getCxxSpecialMember ())
1786
+ if (auto cxxCtor =
1787
+ dyn_cast<cir::CXXCtorAttr>(*calleeFuncOp.getCxxSpecialMember ()))
1788
+ return checkCtor (callOp, cxxCtor);
1802
1789
if (methodDecl.isMoveAssignmentOperator ())
1803
1790
return checkMoveAssignment (callOp, methodDecl);
1804
1791
if (methodDecl.isCopyAssignmentOperator ())
0 commit comments