Skip to content
Snippets Groups Projects
  • Alexey Bataev's avatar
    ecf6de58
    Fix for aggregate copying of variable length arrays. · ecf6de58
    Alexey Bataev authored
    Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:
    
    <total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
    If simple copying is requested, size is calculated like:
    
    <total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
    memcpy() is used with this calculated size of the VLA.
    Differential Revision: http://reviews.llvm.org/D9851
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237768 91177308-0d34-0410-b5e6-96231b3b80d8
    ecf6de58
    History
    Fix for aggregate copying of variable length arrays.
    Alexey Bataev authored
    Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:
    
    <total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
    If simple copying is requested, size is calculated like:
    
    <total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
    memcpy() is used with this calculated size of the VLA.
    Differential Revision: http://reviews.llvm.org/D9851
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237768 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.