aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-07-08 11:10:49 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2022-07-08 11:10:51 +0800
commit354a597b9f3aad2a6a37518d47351adb99688cd2 (patch)
treec8624b5c9ceebcb8712abc897685582f40a1f1d4 /clang/lib/Sema/SemaModule.cpp
parentf27deeee7914feaaed2079a092945ec59421b9e2 (diff)
downloadllvm-354a597b9f3aad2a6a37518d47351adb99688cd2.zip
llvm-354a597b9f3aad2a6a37518d47351adb99688cd2.tar.gz
llvm-354a597b9f3aad2a6a37518d47351adb99688cd2.tar.bz2
[C++20] [Modules] Don't complain about duplicated default template argument across modules
See https://github.com/cplusplus/draft/pull/5204 for a detailed background. Simply, the test redundant-template-default-arg.cpp attached to this patch should be accepted instead of being complained about the redefinition. Reviewed By: urnathan, rsmith, ChuanqiXu Differential Revision: https://reviews.llvm.org/D118034
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r--clang/lib/Sema/SemaModule.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index 3aa124d..e9a1ac17 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -935,3 +935,16 @@ void Sema::PopGlobalModuleFragment() {
"left the wrong module scope, which is not global module fragment");
ModuleScopes.pop_back();
}
+
+bool Sema::isModuleUnitOfCurrentTU(const Module *M) const {
+ assert(M);
+
+ Module *CurrentModuleUnit = getCurrentModule();
+
+ // If we are not in a module currently, M must not be the module unit of
+ // current TU.
+ if (!CurrentModuleUnit)
+ return false;
+
+ return M->isSubModuleOf(CurrentModuleUnit->getTopLevelModule());
+}