[clang] [clang][bytecode] Reject non-VarDecl DeclRefExprs (PR #184141)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 07:07:32 PST 2026


https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/184141

>From 2f1eac807329ecbe95eafb028423504c85a0ceb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 2 Mar 2026 15:49:51 +0100
Subject: [PATCH] [clang][bytecode] Reject non-VarDecl DeclRefExprs

I have no idea how to test this, but this is what the current
interpreter does.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 70d3d80b806d1..828f89c96c91b 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -7293,7 +7293,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
   // we haven't seen yet.
   const auto *VD = dyn_cast<VarDecl>(D);
   if (!VD)
-    return this->emitDummyPtr(D, E);
+    return this->emitInvalid(E);
 
   // For C.
   if (!Ctx.getLangOpts().CPlusPlus) {



More information about the cfe-commits mailing list