Fix flag order of -xc++ in CXXCompiler.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2015-01-28 00:05:48 +00:00
parent db5d6af29b
commit a769d7ff49

View File

@ -38,13 +38,15 @@ class CXXCompiler(object):
self.type = compiler_type self.type = compiler_type
self.version = (major_ver, minor_ver, patchlevel) self.version = (major_ver, minor_ver, patchlevel)
def _basicCmd(self, source_files, out, is_link=False): def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False):
cmd = [] cmd = []
if self.use_ccache and not is_link: if self.use_ccache and not is_link:
cmd += ['ccache'] cmd += ['ccache']
cmd += [self.path] cmd += [self.path]
if out is not None: if out is not None:
cmd += ['-o', out] cmd += ['-o', out]
if input_is_cxx:
cmd += ['-x', 'c++']
if isinstance(source_files, list): if isinstance(source_files, list):
cmd += source_files cmd += source_files
elif isinstance(source_files, str): elif isinstance(source_files, str):
@ -54,12 +56,12 @@ class CXXCompiler(object):
return cmd return cmd
def preprocessCmd(self, source_files, out=None, flags=[]): def preprocessCmd(self, source_files, out=None, flags=[]):
cmd = self._basicCmd(source_files, out) + ['-x', 'c++', '-E'] cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-E']
cmd += self.flags + self.compile_flags + flags cmd += self.flags + self.compile_flags + flags
return cmd return cmd
def compileCmd(self, source_files, out=None, flags=[]): def compileCmd(self, source_files, out=None, flags=[]):
cmd = self._basicCmd(source_files, out) + ['-x', 'c++', '-c'] cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-c']
cmd += self.flags + self.compile_flags + flags cmd += self.flags + self.compile_flags + flags
return cmd return cmd
@ -69,7 +71,7 @@ class CXXCompiler(object):
return cmd return cmd
def compileLinkCmd(self, source_files, out=None, flags=[]): def compileLinkCmd(self, source_files, out=None, flags=[]):
cmd = self._basicCmd(source_files, out, is_link=True) + ['-x', 'c++'] cmd = self._basicCmd(source_files, out, is_link=True)
cmd += self.flags + self.compile_flags + self.link_flags + flags cmd += self.flags + self.compile_flags + self.link_flags + flags
return cmd return cmd