================
@@ -893,6 +902,16 @@ class TokenCollector::Builder {
 TokenBuffer TokenCollector::consume() && {
   PP.setTokenWatcher(nullptr);
   Collector->disable();
+
+  /// If the parser hit an module load fatal error, the TokenCollector will not
+  /// receive an EOF token; we need to add an EOF token to the end of the token
+  /// sequence.
+  if (PP.hadModuleLoaderFatalFailure() &&
----------------
yronglin wrote:

> It is by design that FailedPrerequisiteModules doesn't change header search 
> options.

Thank you for providing this information; I don't have enough experience here.

> In another point of view, we made the change in Lexer and clangd crashes, so 
> the root cause is in Lexer and not clangd.

No, this is a existing issue, not a regression, before 
https://github.com/llvm/llvm-project/pull/173130, the issue already exists. I 
try to use llvm-21.1.8 release, this issue can be reproduced.

> And I think, for parsing C++20 named modules, we don't need to care about 
> PP.hadModuleLoaderFatalFailure(). It shouldn't matter/count for lexing C++20 
> named modules.

Do you mean don't cut off parsing when hit any module load errors? This will 
break clang's current behavior, via: 

```
Clang :: Modules/fatal-module-loader-error.m
Clang :: Modules/load-module-with-errors.m
```

https://github.com/llvm/llvm-project/pull/187858
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to