Remove compiler data from build object

The actual data is in Coredata (which is serialized) and we just held a
reference in Build for (in)convenience.
pull/5412/head
Jon Turney 6 years ago committed by Dylan Baker
parent 3ff758f22d
commit fb35e6faac
  1. 7
      mesonbuild/build.py
  2. 4
      mesonbuild/environment.py
  3. 10
      mesonbuild/interpreter.py

@ -114,9 +114,6 @@ class Build:
self.environment = environment
self.projects = {}
self.targets = OrderedDict()
# Coredata holds the state. This is just here for convenience.
self.compilers = environment.coredata.compilers
self.cross_compilers = environment.coredata.cross_compilers
self.global_args = {}
self.projects_args = {}
self.global_link_args = {}
@ -149,10 +146,6 @@ class Build:
def copy(self):
other = Build(self.environment)
for k, v in self.__dict__.items():
if k in ['compilers', 'cross_compilers']:
# These alias coredata's fields of the same name, and must not
# become copies.
continue
if isinstance(v, (list, dict, set, OrderedDict)):
other.__dict__[k] = v.copy()
else:

@ -411,8 +411,8 @@ class Environment:
# target machine.)
machines = PerThreeMachineDefaultable()
# Similar to coredata.compilers and build.compilers, but lower level in
# that there is no meta data, only names/paths.
# Similar to coredata.compilers, but lower level in that there is no
# meta data, only names/paths.
binaries = PerMachineDefaultable()
# Misc other properties about each machine.

@ -1824,9 +1824,9 @@ class MesonMain(InterpreterObject):
if not isinstance(native, bool):
raise InterpreterException('Type of "native" must be a boolean.')
if native:
clist = self.build.compilers
clist = self.interpreter.coredata.compilers
else:
clist = self.build.cross_compilers
clist = self.interpreter.coredata.cross_compilers
if cname in clist:
return CompilerHolder(clist[cname], self.build.environment, self.interpreter.subproject)
raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname)
@ -2208,7 +2208,7 @@ class Interpreter(InterpreterBase):
def check_cross_stdlibs(self):
if self.build.environment.is_cross_build():
props = self.build.environment.properties.host
for l in self.build.cross_compilers.keys():
for l in self.coredata.cross_compilers.keys():
try:
di = mesonlib.stringlistify(props.get_stdlib(l))
if len(di) != 2:
@ -3857,7 +3857,7 @@ different subdirectory.
self.print_extra_warnings()
def print_extra_warnings(self):
for c in self.build.compilers.values():
for c in self.coredata.compilers.values():
if c.get_id() == 'clang':
self.check_clang_asan_lundef()
break
@ -4074,7 +4074,7 @@ This will become a hard error in the future.''', location=self.current_node)
def get_used_languages(self, target):
result = {}
for i in target.sources:
for lang, c in self.build.compilers.items():
for lang, c in self.coredata.compilers.items():
if c.can_compile(i):
result[lang] = True
break

Loading…
Cancel
Save