Skip to content
Snippets Groups Projects
  • Adrian Prantl's avatar
    1e201d88
    Include getting generated struct offsets in CodegenABITypes · 1e201d88
    Adrian Prantl authored
    This change adds a new function, CodeGen::getFieldNumber, that
    enables a user of clang's code generation to get the field number
    in a generated LLVM IR struct that corresponds to a particular field
    in a C struct.
    
    It is important to expose this information in Clang's code generation
    interface because there is no reasonable way for users of Clang's code
    generation to get this information. In particular:
    
    LLVM struct types do not include field names.
    Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.
    
    Patch by Michael Ferguson!
    
    Differential Revision: https://reviews.llvm.org/D38473
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315392 91177308-0d34-0410-b5e6-96231b3b80d8
    1e201d88
    History
    Include getting generated struct offsets in CodegenABITypes
    Adrian Prantl authored
    This change adds a new function, CodeGen::getFieldNumber, that
    enables a user of clang's code generation to get the field number
    in a generated LLVM IR struct that corresponds to a particular field
    in a C struct.
    
    It is important to expose this information in Clang's code generation
    interface because there is no reasonable way for users of Clang's code
    generation to get this information. In particular:
    
    LLVM struct types do not include field names.
    Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.
    
    Patch by Michael Ferguson!
    
    Differential Revision: https://reviews.llvm.org/D38473
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315392 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CodeGenABITypes.cpp 3.16 KiB