================
@@ -263,8 +263,14 @@ class ScalarExprEmitter : public 
StmtVisitor<ScalarExprEmitter, mlir::Value> {
     return {};
   }
   mlir::Value VisitEmbedExpr(EmbedExpr *e) {
-    cgf.cgm.errorNYI(e->getSourceRange(), "ScalarExprEmitter: embed");
-    return {};
+    assert(e->getDataElementCount() == 1);
+    auto it = e->begin();
+    QualType qualTy = e->getType();
+    mlir::Type ty = cgf.convertType(qualTy);
+    llvm::APInt value = (*it)->getValue();
+    uint64_t actualValue = qualTy->isSignedIntegerType() ? value.getSExtValue()
+                                                         : 
value.getZExtValue();
+    return builder.getConstInt(cgf.getLoc(e->getExprLoc()), ty, actualValue);
----------------
AmrDeveloper wrote:

In `getConstInt`, we pass llvm::APInt always by copy, but I will keep this 
change to NFC PR :D

https://github.com/llvm/llvm-project/pull/172088
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to