llvm.org GIT mirror llvm / ba29b4f
[lit] Only enable LSan on darwin when clang supports it Summary: LSan on darwin doesn't exist on older versions of clang, causing non-boostrapped sanitized buildbots to fail Reviewers: kubamracek, qcolombet, sqlbyme, zturner, modocache Reviewed By: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38703 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315333 91177308-0d34-0410-b5e6-96231b3b80d8 Francis Ricci 2 years ago
1 changed file(s) with 29 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7979
8080 if target_triple:
8181 if re.match(r'^x86_64.*-apple', target_triple):
82 if 'address' in sanitizers:
82 host_cxx = getattr(config, 'host_cxx', None)
83 if 'address' in sanitizers and self.get_clang_has_lsan(host_cxx, target_triple):
8384 self.with_environment(
8485 'ASAN_OPTIONS', 'detect_leaks=1', append_path=True)
8586 if re.match(r'^x86_64.*-linux', target_triple):
198199 clang_dir = clang_dir.replace('\\', '/')
199200 # Ensure the result is an ascii string, across Python2.5+ - Python3.
200201 return clang_dir
202
203 # On macOS, LSan is only supported on clang versions 5 and higher
204 def get_clang_has_lsan(self, clang, triple):
205 if not clang:
206 self.lit_config.warning(
207 "config.host_cxx is unset but test suite is configured to use sanitizers.")
208 return False
209
210 clang_binary = clang.split()[0]
211 version_string, _ = self.get_process_output([clang_binary, '--version'])
212 if not 'clang' in version_string:
213 self.lit_config.warning(
214 "compiler '%s' does not appear to be clang, " % clang_binary +
215 "but test suite is configured to use sanitizers.")
216 return False
217
218 if re.match(r'.*-linux', triple):
219 return True
220
221 if re.match(r'^x86_64.*-apple', triple):
222 version_number = int(re.search(r'version ([0-9]+)\.', version_string).group(1))
223 if 'Apple LLVM' in version_string:
224 return version_number >= 9
225 else:
226 return version_number >= 5
227
228 return False
201229
202230 def make_itanium_abi_triple(self, triple):
203231 m = re.match(r'(\w+)-(\w+)-(\w+)', triple)