1616#include " clang/CIR/Dialect/IR/CIROpsEnums.h"
1717#include " clang/CIR/Dialect/IR/CIRTypes.h"
1818
19+ #include " mlir/IR/Attributes.h"
1920#include " mlir/IR/DialectImplementation.h"
2021#include " mlir/Interfaces/ControlFlowInterfaces.h"
2122#include " mlir/Interfaces/FunctionImplementation.h"
@@ -1872,7 +1873,7 @@ bool cir::FuncOp::isCxxSpecialAssignment() {
18721873}
18731874
18741875std::optional<CtorKind> cir::FuncOp::getCxxConstructorKind () {
1875- auto attr = getCxxSpecialMemberAttr ();
1876+ mlir::Attribute attr = getCxxSpecialMemberAttr ();
18761877 if (attr) {
18771878 if (auto ctor = dyn_cast<CXXCtorAttr>(attr))
18781879 return ctor.getCtorKind ();
@@ -1881,14 +1882,27 @@ std::optional<CtorKind> cir::FuncOp::getCxxConstructorKind() {
18811882}
18821883
18831884std::optional<AssignKind> cir::FuncOp::getCxxSpecialAssignKind () {
1884- auto attr = getCxxSpecialMemberAttr ();
1885+ mlir::Attribute attr = getCxxSpecialMemberAttr ();
18851886 if (attr) {
18861887 if (auto assign = dyn_cast<CXXAssignAttr>(attr))
18871888 return assign.getAssignKind ();
18881889 }
18891890 return std::nullopt ;
18901891}
18911892
1893+ bool cir::FuncOp::isCxxTrivialMemberFunction () {
1894+ mlir::Attribute attr = getCxxSpecialMemberAttr ();
1895+ if (attr) {
1896+ if (auto ctor = dyn_cast<CXXCtorAttr>(attr))
1897+ return ctor.getIsTrivial ();
1898+ if (auto dtor = dyn_cast<CXXDtorAttr>(attr))
1899+ return dtor.getIsTrivial ();
1900+ if (auto assign = dyn_cast<CXXAssignAttr>(attr))
1901+ return assign.getIsTrivial ();
1902+ }
1903+ return false ;
1904+ }
1905+
18921906mlir::Region *cir::FuncOp::getCallableRegion () {
18931907 // TODO(CIR): This function will have special handling for aliases and a
18941908 // check for an external function, once those features have been upstreamed.
0 commit comments