aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUsama Hameed <u_hameed@apple.com>2023-11-16 16:29:05 -0800
committerGitHub <noreply@github.com>2023-11-16 16:29:05 -0800
commit4fe29d0dc2f65e60ae7dde63e7f4595446f3baca (patch)
tree208ed98cfcd111fbb730f6cf7b9204f37b830ded
parentc11be311047c4ae4a79f0b95af0323c1d99a14dd (diff)
downloadllvm-4fe29d0dc2f65e60ae7dde63e7f4595446f3baca.zip
llvm-4fe29d0dc2f65e60ae7dde63e7f4595446f3baca.tar.gz
llvm-4fe29d0dc2f65e60ae7dde63e7f4595446f3baca.tar.bz2
[ASan] AddressSanitizerPass constructor should honor the AsanCtorKind argument (#72330)
Currently, the ConstructorKind member variable in AddressSanitizerPass gets overriden by the ClConstructorKind whether the option is passed from the command line or not. This override should only happen if the ClConstructorKind argument is passed from the command line. Otherwise, the constructor should honor the argument passed to it. This patch makes this fix. rdar://118423755
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 80c044b..c82b926 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -803,7 +803,9 @@ public:
// do globals-gc.
UseCtorComdat(UseGlobalsGC && ClWithComdat && !this->CompileKernel),
DestructorKind(DestructorKind),
- ConstructorKind(ConstructorKind) {
+ ConstructorKind(ClConstructorKind.getNumOccurrences() > 0
+ ? ClConstructorKind
+ : ConstructorKind) {
C = &(M.getContext());
int LongSize = M.getDataLayout().getPointerSizeInBits();
IntptrTy = Type::getIntNTy(*C, LongSize);
@@ -1151,7 +1153,7 @@ AddressSanitizerPass::AddressSanitizerPass(
AsanCtorKind ConstructorKind)
: Options(Options), UseGlobalGC(UseGlobalGC),
UseOdrIndicator(UseOdrIndicator), DestructorKind(DestructorKind),
- ConstructorKind(ClConstructorKind) {}
+ ConstructorKind(ConstructorKind) {}
PreservedAnalyses AddressSanitizerPass::run(Module &M,
ModuleAnalysisManager &MAM) {