Skip to content

Commit 884f263

Browse files
committed
up
Signed-off-by: Chen, Sheng S <sheng.s.chen@intel.com>
1 parent b731c9d commit 884f263

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

clang/lib/DPCT/RulesLang/RulesLang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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()";

clang/lib/DPCT/RulesLang/RulesLangNoneAPIAndType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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()))

0 commit comments

Comments
 (0)