From a83bfeac9d919ee99ce0c99d43339114bfb0f014 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Wed, 20 Apr 2016 20:02:58 +0000 Subject: [PATCH] Rename asan-check-lifetime into asan-stack-use-after-scope Summary: This is done for consistency with asan-use-after-return. I see no other users than tests. Reviewers: aizatsky, kcc Differential Revision: http://reviews.llvm.org/D19306 llvm-svn: 266906 --- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 10 ++++------ llvm/test/Instrumentation/AddressSanitizer/lifetime-uar.ll | 2 +- llvm/test/Instrumentation/AddressSanitizer/lifetime.ll | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index d3969f7..24fdee1 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -164,6 +164,9 @@ static cl::opt ClStack("asan-stack", cl::desc("Handle stack memory"), static cl::opt ClUseAfterReturn("asan-use-after-return", cl::desc("Check return-after-free"), cl::Hidden, cl::init(true)); +static cl::opt ClUseAfterScope("asan-use-after-scope", + cl::desc("Check stack-use-after-scope"), + cl::Hidden, cl::init(false)); // This flag may need to be replaced with -f[no]asan-globals. static cl::opt ClGlobals("asan-globals", cl::desc("Handle global objects"), cl::Hidden, @@ -219,11 +222,6 @@ static cl::opt ClOptStack( "asan-opt-stack", cl::desc("Don't instrument scalar stack variables"), cl::Hidden, cl::init(false)); -static cl::opt ClCheckLifetime( - "asan-check-lifetime", - cl::desc("Use llvm.lifetime intrinsics to insert extra checks"), cl::Hidden, - cl::init(false)); - static cl::opt ClDynamicAllocaStack( "asan-stack-dynamic-alloca", cl::desc("Use dynamic alloca to represent stack variables"), cl::Hidden, @@ -714,7 +712,7 @@ struct FunctionStackPoisoner : public InstVisitor { Intrinsic::ID ID = II.getIntrinsicID(); if (ID == Intrinsic::stackrestore) StackRestoreVec.push_back(&II); if (ID == Intrinsic::localescape) LocalEscapeCall = &II; - if (!ClCheckLifetime) return; + if (!ClUseAfterScope) return; if (ID != Intrinsic::lifetime_start && ID != Intrinsic::lifetime_end) return; // Found lifetime intrinsic, add ASan instrumentation if necessary. diff --git a/llvm/test/Instrumentation/AddressSanitizer/lifetime-uar.ll b/llvm/test/Instrumentation/AddressSanitizer/lifetime-uar.ll index efba8ce..4113483 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/lifetime-uar.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/lifetime-uar.ll @@ -1,5 +1,5 @@ ; Test handling of llvm.lifetime intrinsics in UAR mode. -; RUN: opt < %s -asan -asan-module -asan-use-after-return -asan-check-lifetime -S | FileCheck %s +; RUN: opt < %s -asan -asan-module -asan-use-after-return -asan-use-after-scope -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll b/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll index ac324a9..dc43bc6 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll @@ -1,5 +1,5 @@ ; Test hanlding of llvm.lifetime intrinsics. -; RUN: opt < %s -asan -asan-module -asan-check-lifetime -asan-use-after-return=0 -S | FileCheck %s +; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -- 2.7.4