ChuanqiXu added inline comments.

================
Comment at: clang/lib/Serialization/ASTWriter.cpp:4353
+  // https://github.com/llvm/llvm-project/issues/56490 for example.
+  if (!A || (isa<PreferredNameAttr>(A) && Writer->isWritingNamedModules()))
     return Record.push_back(0);
----------------
The `Writer->isWritingNamedModules()` part is necessary. Otherwise we would 
break the 
https://github.com/llvm/llvm-project/blob/main/clang/test/PCH/decl-attrs.cpp 
test. The reason why the bug is not found by the user of PCH or clang modules 
is that a header generally would be guarded by `#ifndef ... #define` fashion. 
And if we remove the guard, the compiler would emit an error for duplicated 
definition. So the problem only lives in C++20 Named Modules.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130331/new/

https://reviews.llvm.org/D130331

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to