def compile(self, request): contents = request['contents'] # Update the translation unit with the latest contents. # Force a re-parse, in case the user e.g. changed a header file. self.cached_contents = None translation_unit = self._update_translation_unit(contents) if not translation_unit: return {'diagnostics': []} # Return the diagnostics. diagnostics = [] for diag in translation_unit.diagnostics: if diag.spelling == PRAGMA_ONCE_IN_MAIN_FILE and is_header_file(self.src): continue diagnostics.append(self.diagnostic_dict(diag)) return {'diagnostics': diagnostics}
def compile(self, request, response): contents = request['contents'] flags = request['flags'] # Update the translation unit with the latest contents. # Force a re-parse, in case the user e.g. changed a header file. self.cached_contents = None translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: sys.stderr.write( 'Suspicious: requesting compilation of %s without flags' % self.src) response['diagnostics'] = [] return # Return the diagnostics. diagnostics = [] for diag in translation_unit.diagnostics: if diag.spelling == PRAGMA_ONCE_IN_MAIN_FILE and is_header_file(self.src): continue diagnostics.append(self.diagnostic_dict(diag)) response['diagnostics'] = diagnostics
def compile(self, request, response): contents = request['contents'] flags = request['flags'] # Update the translation unit with the latest contents. # Force a re-parse, in case the user e.g. changed a header file. self.cached_contents = None translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: sys.stderr.write( 'Suspicious: requesting compilation of %s without flags' % self.src) response['diagnostics'] = [] return # Return the diagnostics. diagnostics = [] for diag in translation_unit.diagnostics: if diag.spelling == PRAGMA_ONCE_IN_MAIN_FILE and is_header_file( self.src): continue diagnostics.append(self.diagnostic_dict(diag)) response['diagnostics'] = diagnostics