Skip to content

Commit

Permalink
Fix compatibility for CI tests and clang-tidy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 3, 2024
1 parent cdb1990 commit fe68ca5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1911,8 +1911,10 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
m_Sema.LookupName(result, m_Sema.getCurScope());
EnumDecl* cudaMemcpyKindDecl = nullptr;
for (NamedDecl* decl : result)
if ((cudaMemcpyKindDecl = dyn_cast<EnumDecl>(decl)))
if (auto* enumDecl = dyn_cast<EnumDecl>(decl)) {
cudaMemcpyKindDecl = enumDecl;
break;
}
assert(cudaMemcpyKindDecl && "cudaMemcpyKind not found");
QualType cudaMemcpyKindType =
m_Context.getTypeDeclType(cudaMemcpyKindDecl);
Expand All @@ -1925,10 +1927,10 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
}
}
assert(deviceToHostEnumDecl && "cudaMemcpyDeviceToHost not found");
DeclRefExpr* deviceToHostDeclRef =
auto* deviceToHostDeclRef = clad_compat::GetResult<Expr*>(
m_Sema.BuildDeclRefExpr(deviceToHostEnumDecl, cudaMemcpyKindType,
CLAD_COMPAT_ExprValueKind_R_or_PR_Value,
SourceLocation(), nullptr);
SourceLocation(), nullptr));

PreCallStmts.push_back(BuildDeclStmt(dArgDeclCUDA));
Expr* refOp = BuildOp(UO_AddrOf, BuildDeclRef(dArgDeclCUDA));
Expand Down
1 change: 1 addition & 0 deletions test/CUDA/tensor_demo.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %cladclang_cuda -I%S/../../include --cuda-path=%cudapath \
// RUN: --cuda-gpu-arch=%cudaarch %cudaldflags -otensor_demo.out %s
// RUN: ./tensor_demo.out | %filecheck_exec %s
// REQUIRES: cuda-runtime


#include "clad/Differentiator/Differentiator.h"
Expand Down

0 comments on commit fe68ca5

Please sign in to comment.