diff options
author | Vitaly Buka <vitalybuka@google.com> | 2016-08-29 17:41:29 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2016-08-29 17:41:29 +0000 |
commit | 997a48527920ba6e26a7fa40e161bec37aba91fc (patch) | |
tree | e1a88b61041f46ecb60fe2fc729c18af3e9710cb /include | |
parent | f94d4a796c7b8b9c11976de6410ae747073fcfb4 (diff) |
[asan] Separate calculation of ShadowBytes from calculating ASanStackFrameLayout
Summary: No functional changes, just refactoring to make D23947 simpler.
Reviewers: eugenis
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D23954
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Transforms/Utils/ASanStackFrameLayout.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/llvm/Transforms/Utils/ASanStackFrameLayout.h b/include/llvm/Transforms/Utils/ASanStackFrameLayout.h index ef36b822a78..bf3fe11ca05 100644 --- a/include/llvm/Transforms/Utils/ASanStackFrameLayout.h +++ b/include/llvm/Transforms/Utils/ASanStackFrameLayout.h @@ -42,16 +42,14 @@ struct ASanStackVariableDescription { // Output data struct for ComputeASanStackFrameLayout. struct ASanStackFrameLayout { + size_t Granularity; // Frame description, see DescribeAddressIfStack in ASan runtime. SmallString<64> DescriptionString; - // The contents of the shadow memory for the stack frame that we need - // to set at function entry. - SmallVector<uint8_t, 64> ShadowBytes; size_t FrameAlignment; // Alignment for the entire frame. size_t FrameSize; // Size of the frame in bytes. }; -void ComputeASanStackFrameLayout( +ASanStackFrameLayout ComputeASanStackFrameLayout( // The array of stack variables. The elements may get reordered and changed. SmallVectorImpl<ASanStackVariableDescription> &Vars, // AddressSanitizer's shadow granularity. Usually 8, may also be 16, 32, 64. @@ -59,9 +57,21 @@ void ComputeASanStackFrameLayout( // The minimal size of the left-most redzone (header). // At least 4 pointer sizes, power of 2, and >= Granularity. // The resulting FrameSize should be multiple of MinHeaderSize. - size_t MinHeaderSize, - // The result is put here. - ASanStackFrameLayout *Layout); + size_t MinHeaderSize); + +// Returns shadow bytes with marked red zones. This shadow represents the state +// if the stack frame when all local variables are inside of the own scope. +SmallVector<uint8_t, 64> +GetShadowBytes(const SmallVectorImpl<ASanStackVariableDescription> &Vars, + const ASanStackFrameLayout &Layout); + +// Returns shadow bytes with marked red zones and after scope. This shadow +// represents the state if the stack frame when all local variables are outside +// of the own scope. +SmallVector<uint8_t, 64> GetShadowBytesAfterScope( + // The array of stack variables. The elements may get reordered and changed. + const SmallVectorImpl<ASanStackVariableDescription> &Vars, + const ASanStackFrameLayout &Layout); } // llvm namespace |