From f3ecc6091c09a921e4897a305af29d086f31f1a3 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 2 Feb 2016 16:51:59 +0900 Subject: [PATCH] Bug 1245015 - Properly handle ObjC sources in the CompileDB backend. r=mshal --- python/mozbuild/mozbuild/compilation/database.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/mozbuild/mozbuild/compilation/database.py b/python/mozbuild/mozbuild/compilation/database.py index c064708506fd..978b638cc731 100644 --- a/python/mozbuild/mozbuild/compilation/database.py +++ b/python/mozbuild/mozbuild/compilation/database.py @@ -118,17 +118,17 @@ class CompileDBBackend(CommonBackend): 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