]> granicus.if.org Git - clang/commitdiff
[CodeGen] Fix access sizes in new-format TBAA tags
authorIvan A. Kosarev <ikosarev@accesssoftek.com>
Thu, 21 Dec 2017 08:14:16 +0000 (08:14 +0000)
committerIvan A. Kosarev <ikosarev@accesssoftek.com>
Thu, 21 Dec 2017 08:14:16 +0000 (08:14 +0000)
The new format requires to specify both the type of the access
and its size. This patch fixes setting access sizes for TBAA tags
that denote accesses to structure members. This fix affects all
future TBAA metadata tests for the new format, so I guess we
don't need any special tests for this fix.

Differential Revision: https://reviews.llvm.org/D41452

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321250 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index b61b273977dcd3e7240b0e0f5d15fe8684cbfd1d..90eeddf5cc0b68e59b51c8a4123ca2220499197f 100644 (file)
@@ -3801,8 +3801,10 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
       FieldTBAAInfo.Offset +=
           Layout.getFieldOffset(field->getFieldIndex()) / CharWidth;
 
-    // Update the final access type.
+    // Update the final access type and size.
     FieldTBAAInfo.AccessType = CGM.getTBAATypeInfo(FieldType);
+    FieldTBAAInfo.Size =
+        getContext().getTypeSizeInChars(FieldType).getQuantity();
   }
 
   Address addr = base.getAddress();