[clang] [clang][Interp] Add inline descriptor to global variables (PR #72892)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 06:03:33 PST 2024


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/72892 at github.com>


================
@@ -1006,13 +1008,18 @@ bool SetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
 
 template <PrimType Name, class T = typename PrimConv<Name>::T>
 bool GetGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
-  const Block *B = S.P.getGlobal(I);
-
-  if (!CheckConstant(S, OpPC, B->getDescriptor()))
+  const Pointer &Ptr = S.P.getPtrGlobal(I);
+  if (!CheckConstant(S, OpPC, Ptr.getFieldDesc()))
     return false;
-  if (B->isExtern())
+  if (Ptr.isExtern())
     return false;
-  S.Stk.push<T>(B->deref<T>());
+
+  // If a global variable is uninitialized, that means the initialize we've
----------------
AaronBallman wrote:

```suggestion
  // If a global variable is uninitialized, that means the initializer we've
```

https://github.com/llvm/llvm-project/pull/72892


More information about the cfe-commits mailing list