Skip to content

Commit

Permalink
Use BuildCStyleCastExpr for casting
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Mar 15, 2024
1 parent 38e0dff commit 90c3c35
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
++i) {
auto* overloadParam = overloadParams[i];
auto* gradientParam = gradientParams[i];

auto* init = ImplicitCastExpr::Create(
m_Context,
gradientParam->getType(),
clang::CK_BitCast,
BuildDeclRef(overloadParam),
nullptr,
clang::VK_RValue,
clang::FPOptionsOverride()
);
TypeSourceInfo* typeInfo = m_Context.getTrivialTypeSourceInfo(gradientParam->getType());
SourceLocation fakeLoc = utils::GetValidSLoc(m_Sema);
auto* init = m_Sema.BuildCStyleCastExpr(fakeLoc, typeInfo, fakeLoc, BuildDeclRef(overloadParam)).get();

auto* gradientVD =
BuildGlobalVarDecl(gradientParam->getType(), gradientParam->getName(),
Expand Down

0 comments on commit 90c3c35

Please sign in to comment.