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

I have no idea how to test this, but this is what the current interpreter does.

>From b960fcf31cc1107e34b1d111f5a260b71603e2ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 70d3d80b806d1..eadeb900ec845 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -7292,8 +7292,8 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, 
const Expr *E) {
   // Try to lazily visit (or emit dummy pointers for) declarations
   // we haven't seen yet.
   const auto *VD = dyn_cast<VarDecl>(D);
-  if (!VD)
-    return this->emitDummyPtr(D, E);
+  if (!VD
+    return this->emitInvalid(E);
 
   // For C.
   if (!Ctx.getLangOpts().CPlusPlus) {

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

Reply via email to