Skip to content

Commit b4b0010

Browse files
committed
[ASan] AddressSanitizerPass constructor should honor the AsanCtorKind
argument. 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
1 parent 8dfac29 commit b4b0010

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,9 @@ class ModuleAddressSanitizer {
803803
// do globals-gc.
804804
UseCtorComdat(UseGlobalsGC && ClWithComdat && !this->CompileKernel),
805805
DestructorKind(DestructorKind),
806-
ConstructorKind(ConstructorKind) {
806+
ConstructorKind(ClConstructorKind.getNumOccurrences() > 0
807+
? ClConstructorKind
808+
: ConstructorKind) {
807809
C = &(M.getContext());
808810
int LongSize = M.getDataLayout().getPointerSizeInBits();
809811
IntptrTy = Type::getIntNTy(*C, LongSize);
@@ -1149,7 +1151,7 @@ AddressSanitizerPass::AddressSanitizerPass(
11491151
AsanCtorKind ConstructorKind)
11501152
: Options(Options), UseGlobalGC(UseGlobalGC),
11511153
UseOdrIndicator(UseOdrIndicator), DestructorKind(DestructorKind),
1152-
ConstructorKind(ClConstructorKind) {}
1154+
ConstructorKind(ConstructorKind) {}
11531155

11541156
PreservedAnalyses AddressSanitizerPass::run(Module &M,
11551157
ModuleAnalysisManager &MAM) {

0 commit comments

Comments
 (0)