Skip to content

Commit b774787

Browse files
committed
AddressSanitizer: Add use-after-scope to pass options (llvm#130924)
1 parent adfb8ba commit b774787

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
@@ -743,6 +743,8 @@ Expected<AddressSanitizerOptions> parseASanPassOptions(StringRef Params) {
743743

744744
if (ParamName == "kernel") {
745745
Result.CompileKernel = true;
746+
} else if (ParamName == "use-after-scope") {
747+
Result.UseAfterScope = true;
746748
} else {
747749
return make_error<StringError>(
748750
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
@@ -1237,7 +1237,9 @@ void AddressSanitizerPass::printPipeline(
12371237
OS, MapClassName2PassName);
12381238
OS << '<';
12391239
if (Options.CompileKernel)
1240-
OS << "kernel";
1240+
OS << "kernel;";
1241+
if (Options.UseAfterScope)
1242+
OS << "use-after-scope";
12411243
OS << '>';
12421244
}
12431245

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)