@@ -18,34 +18,32 @@ trait AstC2CpgFrontend extends LanguageFrontend {
1818 override type ConfigType = Config
1919
2020 def execute (sourceCodePath : java.io.File ): Cpg = {
21- FileUtil .usingTemporaryFile(suffix = " cpg.bin" ) { tmpCpg =>
22- val cpg = newEmptyCpg(Option (tmpCpg.toString))
23- val pathAsString = sourceCodePath.getAbsolutePath
24- val config = getConfig()
25- .fold(Config ())(_.asInstanceOf [Config ])
26- .withInputPath(pathAsString)
27- .withOutputPath(pathAsString)
28- .withSchemaValidation(ValidationMode .Enabled )
29- val global = new CGlobal ()
21+ val cpg = newEmptyCpg()
22+ val pathAsString = sourceCodePath.getAbsolutePath
23+ val config = getConfig()
24+ .fold(Config ())(_.asInstanceOf [Config ])
25+ .withInputPath(pathAsString)
26+ .withOutputPath(pathAsString)
27+ .withSchemaValidation(ValidationMode .Enabled )
28+ val global = new CGlobal ()
3029
31- val preprocessedFiles = if (config.withPreprocessedFiles) {
32- SourceFiles
33- .determine(
34- config.inputPath,
35- Set (FileDefaults .PreprocessedExt ),
36- ignoredDefaultRegex = Option (DefaultIgnoredFolders ),
37- ignoredFilesRegex = Option (config.ignoredFilesRegex),
38- ignoredFilesPath = Option (config.ignoredFiles)
39- )
40- } else List .empty
30+ val preprocessedFiles = if (config.withPreprocessedFiles) {
31+ SourceFiles
32+ .determine(
33+ config.inputPath,
34+ Set (FileDefaults .PreprocessedExt ),
35+ ignoredDefaultRegex = Option (DefaultIgnoredFolders ),
36+ ignoredFilesRegex = Option (config.ignoredFilesRegex),
37+ ignoredFilesPath = Option (config.ignoredFiles)
38+ )
39+ } else List .empty
4140
42- val sourceFileExtensions = FileDefaults .SourceFileExtensions ++
43- Option .when(config.withPreprocessedFiles)(FileDefaults .PreprocessedExt ).toList
44- new AstCreationPass (cpg, preprocessedFiles, sourceFileExtensions, config, global).createAndApply()
45- new AstCreationPass (cpg, preprocessedFiles, FileDefaults .HeaderFileExtensions , config, global).createAndApply()
46- new FunctionDeclNodePass (cpg, global.unhandledMethodDeclarations(), config).createAndApply()
47- new PostFrontendValidator (cpg, false ).run()
48- cpg
49- }
41+ val sourceFileExtensions = FileDefaults .SourceFileExtensions ++
42+ Option .when(config.withPreprocessedFiles)(FileDefaults .PreprocessedExt ).toList
43+ new AstCreationPass (cpg, preprocessedFiles, sourceFileExtensions, config, global).createAndApply()
44+ new AstCreationPass (cpg, preprocessedFiles, FileDefaults .HeaderFileExtensions , config, global).createAndApply()
45+ new FunctionDeclNodePass (cpg, global.unhandledMethodDeclarations(), config).createAndApply()
46+ new PostFrontendValidator (cpg, false ).run()
47+ cpg
5048 }
5149}
0 commit comments