[llvm-branch-commits] [clang] [C++20] [Modules] Add Decl::isFromGlobalModule (PR #109762)

Chuanqi Xu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 24 00:46:12 PDT 2024


https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/109762

>From 4c51d827e58aaa8c5b3d75b3b61a43627ab53491 Mon Sep 17 00:00:00 2001
From: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: Tue, 24 Sep 2024 15:37:02 +0800
Subject: [PATCH] [C++20] [Modules] Add Decl::isFromGlobalModule

---
 clang/include/clang/AST/DeclBase.h | 3 +++
 clang/lib/AST/DeclBase.cpp         | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 2a4bd0f9c2fda3..04dbd1db6cba81 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -680,6 +680,9 @@ class alignas(8) Decl {
   /// 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;
 
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index b59f118380ca4b..c4e948a38e2641 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -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();
 }



More information about the llvm-branch-commits mailing list