[clang] [C++][Modules] Don't insert `#include` before GMF when `-include` used (PR #212533)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 18:22:19 PDT 2026


================
@@ -142,6 +142,21 @@ void printDependencyDirectivesAsSource(
 /// \returns true if any C++20 named modules related directive was found.
 bool scanInputForCXX20ModulesUsage(StringRef Source);
 
+/// Describes how a source input starts a C++20 module unit.
+enum class ModuleUnitKind {
+  NotModuleUnit,
+  HasGlobalModuleFragment,
+  NamedModuleWithoutGlobalModuleFragment,
+};
+
+/// Scan an input source buffer to determine whether it starts a C++20 module
+/// unit, and whether that module unit has a global module fragment.
+///
+/// \param Source The input source buffer.
+///
+/// \returns the kind of C++20 module unit found in the input.
+ModuleUnitKind scanInputForCXX20ModuleUnit(StringRef Source);
----------------
ChuanqiXu9 wrote:

I feel we have multiple scan* methods right now. Is it possible or good to merge them?

https://github.com/llvm/llvm-project/pull/212533


More information about the cfe-commits mailing list