@@ -998,7 +998,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
998
998
};
999
999
1000
1000
std::optional<cas::IncludeTreeRoot> IncludeTreeRoot;
1001
- std::optional<StringRef> IncludeTreePCHBuffer ;
1001
+ std::optional<cas::IncludeTree::File> IncludeTreePCH ;
1002
1002
if (Input.isIncludeTree ()) {
1003
1003
if (llvm::Error E = cas::IncludeTreeRoot::get (CI.getOrCreateObjectStore (),
1004
1004
Input.getIncludeTree ())
@@ -1012,8 +1012,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
1012
1012
CI.getPreprocessor ().setPPCachedActions (std::move (*PPCachedAct));
1013
1013
CI.getFrontendOpts ().IncludeTimestamps = false ;
1014
1014
1015
- if (llvm::Error E =
1016
- IncludeTreeRoot->getPCHBuffer ().moveInto (IncludeTreePCHBuffer))
1015
+ if (llvm::Error E = IncludeTreeRoot->getPCH ().moveInto (IncludeTreePCH))
1017
1016
return reportError (std::move (E));
1018
1017
1019
1018
auto ModMap = IncludeTreeRoot->getModuleMap ();
@@ -1148,7 +1147,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
1148
1147
CI.getASTContext ().setExternalSource (source);
1149
1148
} else if (CI.getLangOpts ().Modules ||
1150
1149
!CI.getPreprocessorOpts ().ImplicitPCHInclude .empty () ||
1151
- IncludeTreePCHBuffer ) {
1150
+ IncludeTreePCH ) {
1152
1151
// Use PCM or PCH.
1153
1152
assert (hasPCHSupport () && " This action does not have PCH support!" );
1154
1153
ASTDeserializationListener *DeserialListener =
@@ -1167,16 +1166,17 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
1167
1166
DeleteDeserialListener = true ;
1168
1167
}
1169
1168
if (!CI.getPreprocessorOpts ().ImplicitPCHInclude .empty () ||
1170
- IncludeTreePCHBuffer ) {
1169
+ IncludeTreePCH ) {
1171
1170
StringRef PCHPath;
1172
1171
DisableValidationForModuleKind DisableValidation;
1173
1172
std::unique_ptr<llvm::MemoryBuffer> PCHBuffer;
1174
- if (IncludeTreePCHBuffer) {
1175
- PCHPath = " <PCH>" ;
1173
+ if (IncludeTreePCH) {
1176
1174
// No need to do any validation.
1177
1175
DisableValidation = DisableValidationForModuleKind::All;
1178
- PCHBuffer =
1179
- llvm::MemoryBuffer::getMemBuffer (*IncludeTreePCHBuffer, PCHPath);
1176
+ if (llvm::Error E =
1177
+ IncludeTreePCH->getMemoryBuffer ().moveInto (PCHBuffer))
1178
+ return reportError (std::move (E));
1179
+ PCHPath = PCHBuffer->getBufferIdentifier ();
1180
1180
} else {
1181
1181
PCHPath = CI.getPreprocessorOpts ().ImplicitPCHInclude ;
1182
1182
DisableValidation =
0 commit comments