| 417 | } |
| 418 | |
| 419 | void PPCache::cacheIncludeFileInfos(::PPCache::Builder builder, |
| 420 | SymbolTable& targetSymbols, |
| 421 | const SymbolTable& sourceSymbols) { |
| 422 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 423 | |
| 424 | const std::vector<IncludeFileInfo>& sourceIncludeFileInfos = |
| 425 | m_pp->getIncludeFileInfo(); |
| 426 | ::capnp::List<::IncludeFileInfo, ::capnp::Kind::STRUCT>::Builder |
| 427 | targetIncludeFileInfos = |
| 428 | builder.initIncludeFileInfos(sourceIncludeFileInfos.size()); |
| 429 | |
| 430 | for (size_t i = 0, ni = sourceIncludeFileInfos.size(); i < ni; ++i) { |
| 431 | const IncludeFileInfo& sourceIncludeFileInfo = sourceIncludeFileInfos[i]; |
| 432 | ::IncludeFileInfo::Builder targetIncludeFileInfo = |
| 433 | targetIncludeFileInfos[i]; |
| 434 | |
| 435 | SymbolId sectionSymbolId = targetSymbols.copyFrom( |
| 436 | sourceIncludeFileInfo.m_sectionSymbolId, &sourceSymbols); |
| 437 | PathId sectionFileId = |
| 438 | fileSystem->copy(sourceIncludeFileInfo.m_sectionFileId, &targetSymbols); |
| 439 | |
| 440 | targetIncludeFileInfo.setContext( |
| 441 | static_cast<uint32_t>(sourceIncludeFileInfo.m_context)); |
| 442 | targetIncludeFileInfo.setSectionStartLine( |
| 443 | sourceIncludeFileInfo.m_sectionStartLine); |
| 444 | targetIncludeFileInfo.setSectionSymbolId((RawSymbolId)sectionSymbolId); |
| 445 | targetIncludeFileInfo.setSectionFileId((RawPathId)sectionFileId); |
| 446 | targetIncludeFileInfo.setOriginalStartLine( |
| 447 | sourceIncludeFileInfo.m_originalStartLine); |
| 448 | targetIncludeFileInfo.setOriginalStartColumn( |
| 449 | sourceIncludeFileInfo.m_originalStartColumn); |
| 450 | targetIncludeFileInfo.setOriginalEndLine( |
| 451 | sourceIncludeFileInfo.m_originalEndLine); |
| 452 | targetIncludeFileInfo.setOriginalEndColumn( |
| 453 | sourceIncludeFileInfo.m_originalEndColumn); |
| 454 | targetIncludeFileInfo.setAction( |
| 455 | static_cast<uint32_t>(sourceIncludeFileInfo.m_action)); |
| 456 | targetIncludeFileInfo.setIndexOpening(sourceIncludeFileInfo.m_indexOpening); |
| 457 | targetIncludeFileInfo.setIndexClosing(sourceIncludeFileInfo.m_indexClosing); |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | void PPCache::restoreMacros(SymbolTable& targetSymbols, |
| 462 | const ::capnp::List<::Macro>::Reader& sourceMacros, |