diff options
author | Vitaly Buka <vitalybuka@google.com> | 2016-10-26 01:59:57 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2016-10-26 01:59:57 +0000 |
commit | 1c94332e7acb3575e78f110a3ff4e8c86f342a03 (patch) | |
tree | a050d21f381864b37b1d90314cbb51b9f8a1cafd /clang/lib/CodeGen/CGDecl.cpp | |
parent | 8b6af7a9d33af51abdb829350d942e3588faf37c (diff) | |
download | bcm5719-llvm-1c94332e7acb3575e78f110a3ff4e8c86f342a03.tar.gz bcm5719-llvm-1c94332e7acb3575e78f110a3ff4e8c86f342a03.zip |
[CodeGen] Move shouldEmitLifetimeMarkers into more convenient place
Summary: D24693 will need access to it from other places
Reviewers: eugenis
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D24695
llvm-svn: 285158
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 30a9b29ff11..6e48d14303b 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -885,29 +885,12 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D) { EmitAutoVarCleanups(emission); } -/// shouldEmitLifetimeMarkers - Decide whether we need emit the life-time -/// markers. -static bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts, - const LangOptions &LangOpts) { - // Asan uses markers for use-after-scope checks. - if (CGOpts.SanitizeAddressUseAfterScope) - return true; - - // Disable lifetime markers in msan builds. - // FIXME: Remove this when msan works with lifetime markers. - if (LangOpts.Sanitize.has(SanitizerKind::Memory)) - return false; - - // For now, only in optimized builds. - return CGOpts.OptimizationLevel != 0; -} - /// Emit a lifetime.begin marker if some criteria are satisfied. /// \return a pointer to the temporary size Value if a marker was emitted, null /// otherwise llvm::Value *CodeGenFunction::EmitLifetimeStart(uint64_t Size, llvm::Value *Addr) { - if (!shouldEmitLifetimeMarkers(CGM.getCodeGenOpts(), getLangOpts())) + if (!ShouldEmitLifetimeMarkers) return nullptr; llvm::Value *SizeV = llvm::ConstantInt::get(Int64Ty, Size); |