-
Notifications
You must be signed in to change notification settings - Fork 14.4k
AddressSanitizer: Add use-after-scope to pass options #130924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-compiler-rt-sanitizer Author: Guy David (guy-david) ChangesFull diff: https://github.com/llvm/llvm-project/pull/130924.diff 3 Files Affected:
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 1f1e9561fefac..09fdd999a5d25 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -789,6 +789,8 @@ Expected<AddressSanitizerOptions> parseASanPassOptions(StringRef Params) {
if (ParamName == "kernel") {
Result.CompileKernel = true;
+ } else if (ParamName == "use-after-scope") {
+ Result.UseAfterScope = true;
} else {
return make_error<StringError>(
formatv("invalid AddressSanitizer pass parameter '{0}' ", ParamName)
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index b5e9cde2ba5f6..23fd21cb28ca1 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1244,7 +1244,9 @@ void AddressSanitizerPass::printPipeline(
OS, MapClassName2PassName);
OS << '<';
if (Options.CompileKernel)
- OS << "kernel";
+ OS << "kernel;";
+ if (Options.UseAfterScope)
+ OS << "use-after-scope";
OS << '>';
}
diff --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll
index eb3ffe3a098dd..db398d68fd426 100644
--- a/llvm/test/Other/new-pm-print-pipeline.ll
+++ b/llvm/test/Other/new-pm-print-pipeline.ll
@@ -120,3 +120,6 @@
; 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
; CHECK-36: function(speculative-execution<only-if-divergent-target>)
+
+; 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
+; CHECK-37: asan<>,asan<kernel;use-after-scope>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also update the pass to drop ClUseAfterScope
?
Good idea, I confused it with the CodeGen option |
-fno-sanitize-address-use-after-scope ? |
I would prefer a separate PR for that. |
No description provided.