File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6817,7 +6817,7 @@ void MemoryMigrationRule::getSymbolAddressMigration(
68176817 const VarDecl *VD = dyn_cast<VarDecl>(Arg->getDecl ());
68186818 EA .analyze (C->getArg (1 ));
68196819 auto StmtStrArg1 = EA .getReplacedString ();
6820- if (VD ->isLocalVarDeclOrParm ()) {
6820+ if (VD && VD ->isLocalVarDeclOrParm ()) {
68216821 StmtStrArg1 = " const_cast<void *>(" + StmtStrArg1 + " )" ;
68226822 } else {
68236823 StmtStrArg1 += " .get_ptr()" ;
Original file line number Diff line number Diff line change @@ -218,8 +218,8 @@ void MemVarRefMigrationRule::runRule(const MatchFinder::MatchResult &Result) {
218218 }
219219 auto FD = dpct::DpctGlobalInfo::findAncestor<FunctionDecl>(MemVarRef);
220220 auto CE = dpct::DpctGlobalInfo::findAncestor<CallExpr>(MemVarRef);
221- if (FD &&
222- !dyn_cast<VarDecl>(MemVarRef-> getDecl ()) ->isLocalVarDeclOrParm () &&
221+ if (auto VD =dyn_cast<VarDecl>(MemVarRef-> getDecl ()); FD && VD &&
222+ !VD ->isLocalVarDeclOrParm () &&
223223 !isGlobalOrDeviceFuncDecl (FD )) {
224224 if (CE &&
225225 !DpctGlobalInfo::isInCudaPath (CE ->getCalleeDecl ()->getBeginLoc ()))
You can’t perform that action at this time.
0 commit comments