@@ -1003,7 +1003,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
10031003 };
10041004
10051005 std::optional<cas::IncludeTreeRoot> IncludeTreeRoot;
1006- std::optional<StringRef> IncludeTreePCHBuffer ;
1006+ std::optional<cas::IncludeTree::File> IncludeTreePCH ;
10071007 if (Input.isIncludeTree ()) {
10081008 if (llvm::Error E = cas::IncludeTreeRoot::get (CI.getOrCreateObjectStore (),
10091009 Input.getIncludeTree ())
@@ -1017,8 +1017,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
10171017 CI.getPreprocessor ().setPPCachedActions (std::move (*PPCachedAct));
10181018 CI.getFrontendOpts ().IncludeTimestamps = false ;
10191019
1020- if (llvm::Error E =
1021- IncludeTreeRoot->getPCHBuffer ().moveInto (IncludeTreePCHBuffer))
1020+ if (llvm::Error E = IncludeTreeRoot->getPCH ().moveInto (IncludeTreePCH))
10221021 return reportError (std::move (E));
10231022
10241023 auto ModMap = IncludeTreeRoot->getModuleMap ();
@@ -1153,7 +1152,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
11531152 CI.getASTContext ().setExternalSource (source);
11541153 } else if (CI.getLangOpts ().Modules ||
11551154 !CI.getPreprocessorOpts ().ImplicitPCHInclude .empty () ||
1156- IncludeTreePCHBuffer ) {
1155+ IncludeTreePCH ) {
11571156 // Use PCM or PCH.
11581157 assert (hasPCHSupport () && " This action does not have PCH support!" );
11591158 ASTDeserializationListener *DeserialListener =
@@ -1172,16 +1171,17 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
11721171 DeleteDeserialListener = true ;
11731172 }
11741173 if (!CI.getPreprocessorOpts ().ImplicitPCHInclude .empty () ||
1175- IncludeTreePCHBuffer ) {
1174+ IncludeTreePCH ) {
11761175 StringRef PCHPath;
11771176 DisableValidationForModuleKind DisableValidation;
11781177 std::unique_ptr<llvm::MemoryBuffer> PCHBuffer;
1179- if (IncludeTreePCHBuffer) {
1180- PCHPath = " <PCH>" ;
1178+ if (IncludeTreePCH) {
11811179 // No need to do any validation.
11821180 DisableValidation = DisableValidationForModuleKind::All;
1183- PCHBuffer =
1184- llvm::MemoryBuffer::getMemBuffer (*IncludeTreePCHBuffer, PCHPath);
1181+ if (llvm::Error E =
1182+ IncludeTreePCH->getMemoryBuffer ().moveInto (PCHBuffer))
1183+ return reportError (std::move (E));
1184+ PCHPath = PCHBuffer->getBufferIdentifier ();
11851185 } else {
11861186 PCHPath = CI.getPreprocessorOpts ().ImplicitPCHInclude ;
11871187 DisableValidation =
0 commit comments