[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 14:21:32 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG15a484bf6990: [clang][ConstExprEmitter] handle IntegerLiterals (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156154/new/

https://reviews.llvm.org/D156154

Files:
  clang/lib/CodeGen/CGExprConstant.cpp


Index: clang/lib/CodeGen/CGExprConstant.cpp
===================================================================
--- clang/lib/CodeGen/CGExprConstant.cpp
+++ clang/lib/CodeGen/CGExprConstant.cpp
@@ -1215,6 +1215,10 @@
     return Visit(E->getSubExpr(), T);
   }
 
+  llvm::Constant *VisitIntegerLiteral(IntegerLiteral *I, QualType T) {
+    return llvm::ConstantInt::get(CGM.getLLVMContext(), I->getValue());
+  }
+
   llvm::Constant *EmitArrayInitialization(InitListExpr *ILE, QualType T) {
     auto *CAT = CGM.getContext().getAsConstantArrayType(ILE->getType());
     assert(CAT && "can't emit array init for non-constant-bound array");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156154.544095.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/655e4b8a/attachment.bin>


More information about the cfe-commits mailing list