[libcxx] r227273 - Fix flag order of -xc++ in CXXCompiler.

Eric Fiselier eric at efcs.ca
Tue Jan 27 16:05:48 PST 2015


Author: ericwf
Date: Tue Jan 27 18:05:48 2015
New Revision: 227273

URL: http://llvm.org/viewvc/llvm-project?rev=227273&view=rev
Log:
Fix flag order of -xc++ in CXXCompiler.

Modified:
    libcxx/trunk/test/libcxx/compiler.py

Modified: libcxx/trunk/test/libcxx/compiler.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/compiler.py?rev=227273&r1=227272&r2=227273&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/compiler.py (original)
+++ libcxx/trunk/test/libcxx/compiler.py Tue Jan 27 18:05:48 2015
@@ -38,13 +38,15 @@ class CXXCompiler(object):
         self.type = compiler_type
         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 = []
         if self.use_ccache and not is_link:
             cmd += ['ccache']
         cmd += [self.path]
         if out is not None:
             cmd += ['-o', out]
+        if input_is_cxx:
+            cmd += ['-x', 'c++']
         if isinstance(source_files, list):
             cmd += source_files
         elif isinstance(source_files, str):
@@ -54,12 +56,12 @@ class CXXCompiler(object):
         return cmd
 
     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
         return cmd
 
     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
         return cmd
 
@@ -69,7 +71,7 @@ class CXXCompiler(object):
         return cmd
 
     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
         return cmd
 





More information about the cfe-commits mailing list