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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 05:08:13 PST 2024


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
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());
+  if ((S.getLangOpts().CPlusPlus && !VD->hasConstantInitialization() &&
----------------
AaronBallman wrote:

Should we have an assert that we're not in C mode and then drop the check for C++?

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


More information about the cfe-commits mailing list