aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-07-10 10:46:23 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-07-10 10:58:18 +0800
commit91d40ef6e369a73b0147d9153a95c3bc63e14102 (patch)
tree5b2d00e9ca9c76c394a9d7d46dd9c84abad2d356 /clang/lib/AST/DeclBase.cpp
parent9af1f8fbad6c8c38e7e3d6c1cfe7e4b2519db3d8 (diff)
downloadllvm-91d40ef6e369a73b0147d9153a95c3bc63e14102.zip
llvm-91d40ef6e369a73b0147d9153a95c3bc63e14102.tar.gz
llvm-91d40ef6e369a73b0147d9153a95c3bc63e14102.tar.bz2
Revert "[C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (#75912)"
This reverts commit 18f3bcbb13ca83d33223b00761d8cddf463e9ffb, 15bb02650e26875c48889053d6a9697444583721 and 99873b35da7ecb905143c8a6b8deca4d4416f1a9. See the post commit message in https://github.com/llvm/llvm-project/pull/75912 to see the reasons.
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 98c55d6..eef946e 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1122,31 +1122,23 @@ bool Decl::isInExportDeclContext() const {
bool Decl::isInAnotherModuleUnit() const {
auto *M = getOwningModule();
- if (!M || !M->isNamedModule())
+ if (!M)
return false;
- return M != getASTContext().getCurrentNamedModule();
-}
-
-bool Decl::isInCurrentModuleUnit() const {
- auto *M = getOwningModule();
-
- if (!M || !M->isNamedModule())
+ M = M->getTopLevelModule();
+ // FIXME: It is problematic if the header module lives in another module
+ // unit. Consider to fix this by techniques like
+ // ExternalASTSource::hasExternalDefinitions.
+ if (M->isHeaderLikeModule())
return false;
- return M == getASTContext().getCurrentNamedModule();
-}
-
-bool Decl::shouldEmitInExternalSource() const {
- ExternalASTSource *Source = getASTContext().getExternalSource();
- if (!Source)
+ // A global module without parent implies that we're parsing the global
+ // module. So it can't be in another module unit.
+ if (M->isGlobalModule())
return false;
- return Source->hasExternalDefinitions(this) == ExternalASTSource::EK_Always;
-}
-
-bool Decl::isInNamedModule() const {
- return getOwningModule() && getOwningModule()->isNamedModule();
+ assert(M->isNamedModule() && "New module kind?");
+ return M != getASTContext().getCurrentNamedModule();
}
bool Decl::isFromExplicitGlobalModule() const {