(hFile *IncludedFile, file *os.File, shouldCache bool)
| 366 | } |
| 367 | |
| 368 | func (inc *ownIncludesParser) processHFile(hFile *IncludedFile, file *os.File, shouldCache bool) { |
| 369 | fileSHA256, buffer, err := CalcSHA256OfFile(file, hFile.fileSize, inc.preallocatedBuf) |
| 370 | _ = file.Close() // close a file before digging into nested .h, not to keep open descriptors |
| 371 | if err != nil { |
| 372 | inc.err = err // keep the last error here |
| 373 | return |
| 374 | } |
| 375 | |
| 376 | hFile.fileSHA256 = fileSHA256 |
| 377 | includeStatements := inc.collectIncludeStatementsInFile(buffer) |
| 378 | |
| 379 | if !shouldCache { |
| 380 | for _, includedArg := range includeStatements { |
| 381 | inc.onHashInclude(hFile.fileName, includedArg, false) |
| 382 | } |
| 383 | } else { |
| 384 | nestedIncludes := make([]string, 0, len(includeStatements)) |
| 385 | for _, includedArg := range includeStatements { |
| 386 | if hNested := inc.onHashInclude(hFile.fileName, includedArg, false); hNested != nil { |
| 387 | nestedIncludes = append(nestedIncludes, hNested.fileName) |
| 388 | } |
| 389 | } |
| 390 | inc.includesCache.AddHFileInfo(hFile.fileName, hFile.fileSize, hFile.fileSHA256, nestedIncludes) |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | func (inc *ownIncludesParser) processCppInFile(cppInFile string, searchForPch bool, explicitIncludes []string) (IncludedFile, error) { |
| 395 | // on some systems, g++ includes <stdc-predef.h> implicitly |
no test coverage detected