[sanitizer] Allow sanitize coverage w/o sanitizers.
The reason is that this (a) seems to work just fine and (b) useful when building stuff with
sanitizer+coverage, but need to exclude the sanitizer for a particular source file.
llvm-svn: 272717
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index d64ac53..4d30a1b 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -159,11 +159,10 @@
}
bool SanitizerArgs::needsUbsanRt() const {
- return (Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) &&
- !Sanitizers.has(Address) &&
- !Sanitizers.has(Memory) &&
- !Sanitizers.has(Thread) &&
- !CfiCrossDso;
+ return ((Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) ||
+ CoverageFeatures) &&
+ !Sanitizers.has(Address) && !Sanitizers.has(Memory) &&
+ !Sanitizers.has(Thread) && !CfiCrossDso;
}
bool SanitizerArgs::needsCfiRt() const {
@@ -485,10 +484,10 @@
continue;
}
CoverageFeatures |= parseCoverageFeatures(D, Arg);
- // If there is trace-pc, allow it w/o any of the sanitizers.
- // Otherwise, require that one of the supported sanitizers is present.
- if ((CoverageFeatures & CoverageTracePC) ||
- (AllAddedKinds & SupportsCoverage)) {
+
+ // Disable coverage and not claim the flags if there is at least one
+ // non-supporting sanitizer.
+ if (!(AllAddedKinds & ~setGroupBits(SupportsCoverage))) {
Arg->claim();
} else {
CoverageFeatures = 0;