Skip to content

Commit 9820248

Browse files
authored
AddressSanitizer: Add use-after-scope to pass options (#130924)
1 parent 982527e commit 9820248

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,8 @@ Expected<AddressSanitizerOptions> parseASanPassOptions(StringRef Params) {
790790

791791
if (ParamName == "kernel") {
792792
Result.CompileKernel = true;
793+
} else if (ParamName == "use-after-scope") {
794+
Result.UseAfterScope = true;
793795
} else {
794796
return make_error<StringError>(
795797
formatv("invalid AddressSanitizer pass parameter '{0}' ", ParamName)

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,9 @@ void AddressSanitizerPass::printPipeline(
12441244
OS, MapClassName2PassName);
12451245
OS << '<';
12461246
if (Options.CompileKernel)
1247-
OS << "kernel";
1247+
OS << "kernel;";
1248+
if (Options.UseAfterScope)
1249+
OS << "use-after-scope";
12481250
OS << '>';
12491251
}
12501252

llvm/test/Other/new-pm-print-pipeline.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,6 @@
120120

121121
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='speculative-execution<only-if-divergent-target>' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-36
122122
; CHECK-36: function(speculative-execution<only-if-divergent-target>)
123+
124+
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(asan<>,asan<kernel;use-after-scope>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-37
125+
; CHECK-37: asan<>,asan<kernel;use-after-scope>

0 commit comments

Comments
 (0)