[clang] [CIR] Emit init of local variables (PR #130164)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 10 10:17:39 PDT 2025
================
@@ -105,6 +106,27 @@ class CIRGenFunction : public CIRGenTypeCache {
mlir::Value emitAlloca(llvm::StringRef name, mlir::Type ty,
mlir::Location loc, clang::CharUnits alignment);
+private:
+ // Track current variable initialization (if there's one)
+ const clang::VarDecl *currVarDecl = nullptr;
+ class VarDeclContext {
+ CIRGenFunction &p;
+ const clang::VarDecl *oldVal = nullptr;
+
+ public:
+ VarDeclContext(CIRGenFunction &p, const VarDecl *value) : p(p) {
+ if (p.currVarDecl)
----------------
andykaylor wrote:
You're right. I can see no reason this condition needs to be here.
https://github.com/llvm/llvm-project/pull/130164
More information about the cfe-commits
mailing list