mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Merge fac71a215c into aa30589c12
				
					
				
			This commit is contained in:
		
						commit
						0ba801e81c
					
				
					 2 changed files with 91 additions and 0 deletions
				
			
		
							
								
								
									
										30
									
								
								.clang-tidy
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.clang-tidy
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| --- | ||||
| Checks: 'bugprone-*,cert-*,cppcoreguidelines-*,modernize-*,performance-*,readability-*,portability-*,clang-analyzer-unix,clang-analyzer-security,clang-analyzer-deadcode,clang-analyzer-core,clang-analyzer-cplusplus,clang-analyzer-optin,-modernize-use-trailing-return-type,-cppcoreguidelines-avoid-magic-numbers,-readability-redundant-member-init,-readability-else-after-return,-readability-implicit-bool-conversion,-cppcoreguidelines-pro-type-vararg,-readability-named-parameter,-readability-magic-numbers,-clang-diagnostic-c++17-extensions' | ||||
| WarningsAsErrors: '' | ||||
| HeaderFilterRegex: '(backends|frontends|kernel|passes|techlibs)/.*' | ||||
| FormatStyle: 'none' | ||||
| AnalyzeTemporaryDtors: false | ||||
| CheckOptions: | ||||
|   - key:             cert-dcl16-c.NewSuffixes | ||||
|     value:           'L;LL;LU;LLU' | ||||
|   - key:             cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||||
|     value:           '0' | ||||
|   - key:             cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||||
|     value:           '0' | ||||
|   - key:             cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||||
|     value:           '1' | ||||
|   - key:             modernize-loop-convert.MaxCopySize | ||||
|     value:           '16' | ||||
|   - key:             modernize-loop-convert.MinConfidence | ||||
|     value:           reasonable | ||||
|   - key:             modernize-loop-convert.NamingStyle | ||||
|     value:           camelBack | ||||
|   - key:             modernize-pass-by-value.IncludeStyle | ||||
|     value:           llvm | ||||
|   - key:             modernize-replace-auto-ptr.IncludeStyle | ||||
|     value:           llvm | ||||
|   - key:             modernize-use-nullptr.NullMacros | ||||
|     value:           'NULL' | ||||
|   - key:             readability-braces-around-statements.ShortStatementLines | ||||
|     value:           '4' | ||||
| ... | ||||
							
								
								
									
										61
									
								
								misc/run-clang-tidy.py
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										61
									
								
								misc/run-clang-tidy.py
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,61 @@ | |||
| #!/usr/bin/env python3 | ||||
| 
 | ||||
| import sys | ||||
| 
 | ||||
| from argparse           import ArgumentParser, ArgumentDefaultsHelpFormatter | ||||
| from pathlib            import Path | ||||
| from subprocess         import run | ||||
| from concurrent.futures import ThreadPoolExecutor | ||||
| 
 | ||||
| def main() -> int: | ||||
| 	parser = ArgumentParser( | ||||
| 		formatter_class = ArgumentDefaultsHelpFormatter, | ||||
| 		description     = 'clang-tidy runner', | ||||
| 		prog            = 'run-clang-tidy.py', | ||||
| 	) | ||||
| 
 | ||||
| 	parser.add_argument( | ||||
| 		'--source-path', '-s', | ||||
| 		required = True, | ||||
| 		type     = Path, | ||||
| 		metavar  = 'source_path', | ||||
| 		help     = 'Path to the source directory to run clang-tidy in' | ||||
| 	) | ||||
| 
 | ||||
| 	parser.add_argument( | ||||
| 		'--build-path', '-p', | ||||
| 		required = True, | ||||
| 		type     = Path, | ||||
| 		metavar  = 'build_path', | ||||
| 		help     = 'Path to the build directory containing a compile_commands.json' | ||||
| 	) | ||||
| 
 | ||||
| 	args = parser.parse_args() | ||||
| 
 | ||||
| 	def glob_files(): | ||||
| 		paths    = {'backends', 'frontend', 'kernel', 'passes', 'techlibs'} | ||||
| 		suffixes = {'cc', 'h'} | ||||
| 
 | ||||
| 		for path in paths: | ||||
| 			for suffix in suffixes: | ||||
| 				yield args.source_path.glob(f'{path}/**/*.{suffix}') | ||||
| 
 | ||||
| 	def gather_files(): | ||||
| 		for file_glob in glob_files(): | ||||
| 			for file in file_glob: | ||||
| 				yield file | ||||
| 
 | ||||
| 	extra_args = () | ||||
| 	futures = [] | ||||
| 
 | ||||
| 	with ThreadPoolExecutor() as pool: | ||||
| 		for file in gather_files(): | ||||
| 			futures.append(pool.submit( | ||||
| 				run, ['clang-tidy', *extra_args, '-p', args.build_path, file] | ||||
| 			)) | ||||
| 
 | ||||
| 	return max((future.result().returncode for future in futures)) | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
| 	sys.exit(main()) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue