diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-04-13 15:08:21 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-04-13 15:14:34 +0800 |
commit | c1f76363e0db41ab6eb9ebedd687ee098491e9b7 (patch) | |
tree | 339ff0b3afe00e3a039eec53f21e4cefbb42bebf /clang/lib/Sema/SemaModule.cpp | |
parent | e4e0bf63d0b3615b9a2481be6769a3c876763ec6 (diff) | |
download | llvm-c1f76363e0db41ab6eb9ebedd687ee098491e9b7.zip llvm-c1f76363e0db41ab6eb9ebedd687ee098491e9b7.tar.gz llvm-c1f76363e0db41ab6eb9ebedd687ee098491e9b7.tar.bz2 |
[C++20] [Modules] Continue parsing after we found reserved module names
Close https://github.com/llvm/llvm-project/issues/62112
In the previous change, we'll stop parsing directly after we found
reserved module names. But this may be too aggressive. This patch
changes this. Note that the parsing will still be stopped if the module
name is `module` or `import`.
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 6c39cc0..84a1fd8 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -162,7 +162,8 @@ static bool DiagReservedModuleName(Sema &S, const IdentifierInfo *II, case Invalid: return S.Diag(Loc, diag::err_invalid_module_name) << II; case Reserved: - return S.Diag(Loc, diag::warn_reserved_module_name) << II; + S.Diag(Loc, diag::warn_reserved_module_name) << II; + return false; } llvm_unreachable("fell off a fully covered switch"); } @@ -267,10 +268,8 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, if (!getSourceManager().isInSystemHeader(Path[0].second) && (FirstComponentName == "std" || (FirstComponentName.startswith("std") && - llvm::all_of(FirstComponentName.drop_front(3), &llvm::isDigit)))) { + llvm::all_of(FirstComponentName.drop_front(3), &llvm::isDigit)))) Diag(Path[0].second, diag::warn_reserved_module_name) << Path[0].first; - return nullptr; - } // Then test all of the components in the path to see if any of them are // using another kind of reserved or invalid identifier. |