[clang] [Clang] Fix 'counted_by' for nested struct pointers (PR #110497)
    Jan Hendrik Farr via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Oct  2 19:02:47 PDT 2024
    
    
  
================
@@ -1164,15 +1163,15 @@ llvm::Value *CodeGenFunction::EmitLoadOfCountedByField(
     return nullptr;
 
   llvm::Value *Res = nullptr;
-  if (StructBase->isLValue()) {
-    LValue LV = EmitLValue(StructBase);
-    Address Addr = LV.getAddress();
-    Res = Addr.emitRawPointer(*this);
-  } else {
+  if (StructBase->getType()->isPointerType()) {
     LValueBaseInfo BaseInfo;
     TBAAAccessInfo TBAAInfo;
     Address Addr = EmitPointerWithAlignment(StructBase, &BaseInfo, &TBAAInfo);
     Res = Addr.emitRawPointer(*this);
+  } else {
----------------
Cydox wrote:
added that extra check
https://github.com/llvm/llvm-project/pull/110497
    
    
More information about the cfe-commits
mailing list