================
@@ -5341,6 +5341,15 @@ void CodeGenModule::EmitGlobalVarDefinition(const 
VarDecl *D,
       !IsDefinitionAvailableExternally &&
       D->needsDestruction(getContext()) == QualType::DK_cxx_destructor;
 
+  // It is helpless to emit the definition for an available_externally variable
+  // which can't be marked as const.
+  // We don't need to check if it needs global ctor or dtor. See the above
+  // comment for ideas.
+  if (IsDefinitionAvailableExternally &&
+      (!D->hasConstantInitialization() ||
+       !D->getType().isConstantStorage(getContext(), true, true)))
----------------
ChuanqiXu9 wrote:

(we think) the available externally variables don't need ctor or dtor in the 
current TU.  We mentioned this in the comment.

https://github.com/llvm/llvm-project/pull/93530
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to