Skip to content

Commit da25516

Browse files
committed
[cling] Fix C++20 builds
1 parent 7fc744b commit da25516

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

interpreter/cling/lib/Interpreter/Interpreter.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,17 @@ namespace cling {
912912
// context triggered this import!
913913
DeclContext *OldDC = getSema().CurContext;
914914
getSema().CurContext = getSema().getASTContext().getTranslationUnitDecl();
915-
bool success =
916-
!getSema().ActOnModuleImport(ValidLoc, /*ExportLoc*/ {}, ValidLoc,
917-
std::make_pair(II, ValidLoc)).isInvalid();
915+
916+
// Fix C++20 builds caused by commit:
917+
// llvm-project/commit/574ee1c02ef73b66c5957cf93888234b0471695f
918+
// We are loading clang modules here and not C++20 modules
919+
auto Path = std::make_pair(II, ValidLoc);
920+
Module* Mod = getSema().getModuleLoader().loadModule(
921+
ValidLoc, Path, Module::AllVisible, /*IsInclusionDirective=*/false);
922+
bool success = Mod && !getSema()
923+
.ActOnModuleImport(ValidLoc, /*ExportLoc*/ {},
924+
ValidLoc, Mod, Path)
925+
.isInvalid();
918926
getSema().CurContext = OldDC;
919927

920928
if (success) {

0 commit comments

Comments
 (0)