Include getting generated struct offsets in CodegenABITypes
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
Showing
- include/clang/CodeGen/CodeGenABITypes.h 8 additions, 1 deletioninclude/clang/CodeGen/CodeGenABITypes.h
- lib/CodeGen/CodeGenABITypes.cpp 7 additions, 0 deletionslib/CodeGen/CodeGenABITypes.cpp
- unittests/CodeGen/CMakeLists.txt 1 addition, 0 deletionsunittests/CodeGen/CMakeLists.txt
- unittests/CodeGen/CodeGenExternalTest.cpp 302 additions, 0 deletionsunittests/CodeGen/CodeGenExternalTest.cpp
Loading
Please register or sign in to comment