[clang] [C++20][Modules] Quote header unit name in preprocessor output (-E) (PR #112883)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 23 18:19:53 PDT 2024


================
@@ -952,13 +952,15 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
       continue;
     } else if (Tok.is(tok::annot_header_unit)) {
       // This is a header-name that has been (effectively) converted into a
-      // module-name.
+      // module-name, print them inside quote.
       // FIXME: The module name could contain non-identifier module name
-      // components. We don't have a good way to round-trip those.
+      // components and OS specific file paths components. We don't have a good
+      // way to round-trip those.
       Module *M = reinterpret_cast<Module *>(Tok.getAnnotationValue());
       std::string Name = M->getFullModuleName();
-      Callbacks->OS->write(Name.data(), Name.size());
-      Callbacks->HandleNewlinesInToken(Name.data(), Name.size());
+      *Callbacks->OS << '"';
----------------
ChuanqiXu9 wrote:

No, I don't want to block such issues.

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


More information about the cfe-commits mailing list