Implement a cpp blacklist for LLVM dependency
This adds a set of private flags that are removed from the output of
`llvm-config --cppflags` before storing them. This is unfortunately
necessary since some versions of LLVM include absolute garbage like
'-DNDEBUG' in their CPP flags, and we don't want to pass those.
@@ -1631,6 +1631,7 @@ class LLVMDependency(Dependency):
llvmconfig = None
_llvmconfig_found = False
__best_found = None
+ __cpp_blacklist = {'-DNDEBUG'}
def __init__(self, environment, kwargs):
super().__init__('llvm-config', kwargs)
@@ -1676,7 +1677,7 @@ class LLVMDependency(Dependency):
p, out = Popen_safe([self.llvmconfig, '--cppflags'])[:2]
if p.returncode != 0:
raise DependencyException('Could not generate includedir for LLVM.')
- self.cargs = shlex.split(out)
+ self.cargs = list(mesonlib.OrderedSet(shlex.split(out)).difference(self.__cpp_blacklist))
p, out = Popen_safe([self.llvmconfig, '--components'])[:2]
if p.returncode != 0:
