diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-09 18:17:36 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-09 18:17:36 +0000 |
commit | 9b9cb90f3ef7749fe07f9df01a280b3cb0aec87e (patch) | |
tree | 170e69f47878bfbf2f5c0ebb0d2d861fcbb35403 | |
parent | c83106ee38048acbe737ef112e8d51c9b5bd42d7 (diff) | |
download | meson-vsasan.zip meson-vsasan.tar.gz meson-vsasan.tar.bz2 |
Add address sanitizer support for Visual Studio.vsasan
-rw-r--r-- | mesonbuild/compilers/cpp.py | 1 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 4d55ccd..d0e3fd2 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -663,7 +663,6 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) MSVCCompiler.__init__(self, target) - self.base_options = {OptionKey(o) for o in ['b_pch', 'b_vscrt', 'b_ndebug']} # FIXME add lto, pgo and the like self.id = 'msvc' def get_options(self) -> 'KeyedOptionDictType': diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 3ba0610..2b173eb 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -125,6 +125,8 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): self.machine = 'arm' else: self.machine = target + if mesonlib.version_compare(self.version, '>=19.29.29917'): + self.base_options.add(mesonlib.OptionKey('b_sanitize')) assert self.linker is not None self.linker.machine = self.machine @@ -159,6 +161,13 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): def get_no_optimization_args(self) -> T.List[str]: return ['/Od'] + def sanitizer_compile_args(self, value: str) -> T.List[str]: + if value == 'none': + return [] + if value != 'address': + raise mesonlib.MesonException('VS only supports address sanitizer at the moment.') + return ['/fsanitize=address'] + def get_output_args(self, target: str) -> T.List[str]: if target.endswith('.exe'): return ['/Fe' + target] |