Skip to content

Commit

Permalink
having helper in header file
Browse files Browse the repository at this point in the history
  • Loading branch information
ghehg committed Sep 27, 2024
1 parent c6e2b3d commit 9de1a88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 0 additions & 10 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,4 @@ mlir::cir::ConstantOp CIRGenBuilderTy::getConstInt(mlir::Location loc,
return create<mlir::cir::ConstantOp>(loc, intTy,
mlir::cir::IntAttr::get(t, C));
}

mlir::cir::ConstantOp CIRGenBuilderTy::getConstFP(mlir::Location loc,
mlir::Type t,
llvm::APFloat fpVal) {
assert((mlir::isa<mlir::cir::SingleType, mlir::cir::DoubleType>(t)) &&
"expected mlir::cir::SingleType or mlir::cir::DoubleType");
return create<mlir::cir::ConstantOp>(loc, t,
getAttr<mlir::cir::FPAttr>(t, fpVal));
}

} // namespace cir
7 changes: 6 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,12 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy {
uint64_t C);

mlir::cir::ConstantOp getConstFP(mlir::Location loc, mlir::Type t,
llvm::APFloat fpVal);
llvm::APFloat fpVal) {
assert((mlir::isa<mlir::cir::SingleType, mlir::cir::DoubleType>(t)) &&
"expected mlir::cir::SingleType or mlir::cir::DoubleType");
return create<mlir::cir::ConstantOp>(loc, t,
getAttr<mlir::cir::FPAttr>(t, fpVal));
}

/// Create constant nullptr for pointer-to-data-member type ty.
mlir::cir::ConstantOp getNullDataMemberPtr(mlir::cir::DataMemberType ty,
Expand Down

0 comments on commit 9de1a88

Please sign in to comment.