Bug 1245015 - Properly handle ObjC sources in the CompileDB backend. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 02 Feb 2016 16:51:59 +0900
changeset 282970 40ec3e6ccdf7bcc7e12f5beb9ce6915756294acd
parent 282969 d3d9deb0a4b1625c9194baf1c4435b88c75c33d4
child 282971 c872035a2cad3502273d44555a08545678316f20
push id19510
push usergwagner@mozilla.com
push dateMon, 08 Feb 2016 15:56:48 +0000
treeherderb2g-inbound@a3d54e32dee1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1245015
milestone47.0a1
Bug 1245015 - Properly handle ObjC sources in the CompileDB backend. r=mshal
python/mozbuild/mozbuild/compilation/database.py
--- a/python/mozbuild/mozbuild/compilation/database.py
+++ b/python/mozbuild/mozbuild/compilation/database.py
@@ -113,27 +113,27 @@ class CompileDBBackend(CommonBackend):
             build_vars[name] = util.sanitize_cflags(shell_split(build_vars[name]))
 
         self._flags[directory] = build_vars
         return self._flags[directory]
 
     def _build_db_line(self, objdir, cenv, filename, canonical_suffix, flags, ishost):
         # Distinguish between host and target files.
         prefix = 'HOST_' if ishost else ''
-        if canonical_suffix == '.c':
+        if canonical_suffix in ('.c', '.m'):
             compiler = cenv.substs[prefix + 'CC']
             cflags = list(flags['COMPILE_CFLAGS'])
             # Add the Objective-C flags if needed.
-            if filename.endswith('.m'):
+            if canonical_suffix == '.m':
                 cflags.extend(flags['COMPILE_CMFLAGS'])
-        elif canonical_suffix == '.cpp':
+        elif canonical_suffix in ('.cpp', '.mm'):
             compiler = cenv.substs[prefix + 'CXX']
             cflags = list(flags['COMPILE_CXXFLAGS'])
             # Add the Objective-C++ flags if needed.
-            if filename.endswith('.mm'):
+            if canonical_suffix == '.mm':
                 cflags.extend(flags['COMPILE_CMMFLAGS'])
         else:
             return
 
         cmd = compiler.split() + [
           '-o', '/dev/null', '-c'
         ] + cflags + [ filename ]