================
@@ -4087,10 +4087,14 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F,
std::errc::illegal_byte_sequence,
"Invalid PENDING_IMPLICIT_INSTANTIATIONS block");
- for (unsigned I = 0, N = Record.size(); I != N; /* in loop */) {
- PendingInstantiations.push_back(
- {ReadDeclID(F, Record, I),
- ReadSourceLocation(F, Record, I).getRawEncoding()});
+ // For standard C++20 module, we will only reads the instantiations
+ // if it is the main file.
+ if (!F.StandardCXXModule || F.Kind == MK_MainFile) {
----------------
ChuanqiXu9 wrote:
> So is there a way to consolidate this check into a function?
If you mean have a function returning the condition "(!F.StandardCXXModule ||
F.Kind == MK_MainFile)", yes we can do that. But I don't have a good name/good
abstraction model for it yet. I don't have a strong feeling but I have the
current style looks straight forward.
> This feels like something that may change and someone may forget to update
> both places.
I don't feel they may change as the C++20 modules goes stable nowadays. For
updating, on the one hand, the current serialization/deserialization framework
almost always asks us to update the both places. On the other hand, for the
change itself, technically we don't have to update both places, as the change
in the writer side says "we don't need to write it" and the reader side says
"we don't need to read it". It is actually "fine" to omit either side.
https://github.com/llvm/llvm-project/pull/167468
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits