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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 11:42:36 PDT 2023


nickdesaulniers updated this revision to Diff 543665.
nickdesaulniers retitled this revision from "[clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts" to "[clang][ConstExprEmitter] handle IntegerLiterals".
nickdesaulniers added a comment.

- remove mention of IntegralCasts from commit description


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.543665.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230724/9fea7c90/attachment.bin>


More information about the cfe-commits mailing list