[C++20] [Modules] Add Decl::isFromGlobalModule
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 24 Sep 2024 07:37:02 +0000 (15:37 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 24 Sep 2024 07:41:11 +0000 (15:41 +0800)
clang/include/clang/AST/DeclBase.h
clang/lib/AST/DeclBase.cpp

index 2a4bd0f9c2fda32e04e74e7d07663d373ef72491..04dbd1db6cba810b53b08c2dc813430558e19f00 100644 (file)
@@ -680,6 +680,9 @@ public:
   /// Whether this declaration comes from explicit global module.
   bool isFromExplicitGlobalModule() const;
 
+  /// Whether this declaration comes from global module.
+  bool isFromGlobalModule() const;
+
   /// Whether this declaration comes from a named module.
   bool isInNamedModule() const;
 
index b59f118380ca4b4a4e33a0242718529d05649fd8..c4e948a38e2641c0f5124b932ae3d706da438ffa 100644 (file)
@@ -1161,6 +1161,10 @@ bool Decl::isFromExplicitGlobalModule() const {
   return getOwningModule() && getOwningModule()->isExplicitGlobalModule();
 }
 
+bool Decl::isFromGlobalModule() const {
+  return getOwningModule() && getOwningModule()->isGlobalModule();
+}
+
 bool Decl::isInNamedModule() const {
   return getOwningModule() && getOwningModule()->isNamedModule();
 }