================ @@ -142,6 +142,15 @@ void printDependencyDirectivesAsSource( /// \returns true if any C++20 named modules related directive was found. bool scanInputForCXX20ModulesUsage(StringRef Source); +/// Scan an input source buffer, and check whether the input ssource is a +/// preprocessed output. +/// +/// \param Source The input source buffer. +/// +/// \returns true if any '__preprocessed_module' or '__preprocessed_import' +/// directive was found. ---------------- hubert-reinterpretcast wrote:
Checking for `__preprocessed_module` or `__preprocessed_import` may be a useful strategy, but it doesn't cover non-module cases that end up looking like module cases. Consider this as a preprocessed file: ```cpp typedef int module; module x; ``` Compiling with `-xc++-cpp-output` should suppress `module` directive recognition. `__preprocessed_module` can either get the directive treatment or be accepted directly by phase 7 in a module declaration. In the latter case, `__preprocessed_module` will work even if there are preprocessing tokens on the same line that precede it. An example of the `-x` option being consumed is in https://github.com/llvm/llvm-project/blob/3cf170c439086cf1465fd670f4fcbceefc522b92/clang/lib/Frontend/InitPreprocessor.cpp#L1654 https://github.com/llvm/llvm-project/pull/107168 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
