[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:32 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>


================
@@ -332,6 +332,22 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
   return false;
 }
 
+bool CheckGlobalInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
+  if (Ptr.isInitialized())
+    return true;
+
+  const VarDecl *VD = cast<VarDecl>(Ptr.getDeclDesc()->asValueDecl());
----------------
AaronBallman wrote:

```suggestion
  const auto *VD = cast<VarDecl>(Ptr.getDeclDesc()->asValueDecl());
```

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


More information about the cfe-commits mailing list