[clang] [Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros (PR #90574)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 23:44:17 PDT 2024
================
@@ -3071,6 +3073,45 @@ struct EmbedAnnotationData {
/// Registry of pragma handlers added by plugins
using PragmaHandlerRegistry = llvm::Registry<PragmaHandler>;
+/// Module/Partition name token sequance.
+///
+/// module-name:
+/// module-name-qualifier[opt] identifier
+///
+/// module-name-qualifier
+/// module-name-qualifier[opt] identifier .
+class ModuleNameInfo {
+ friend class Preprocessor;
+ ArrayRef<Token> ModuleName;
+ ArrayRef<Token> PartitionName;
+
+ ModuleNameInfo(ArrayRef<Token> Module, ArrayRef<Token> Partition)
+ : ModuleName(Module), PartitionName(Partition) {}
+
+public:
+ ArrayRef<Token> getTokens() const {
+ if (ModuleName.empty())
+ return PartitionName;
+ if (PartitionName.empty())
+ return ModuleName;
+ return ArrayRef(ModuleName.begin(), PartitionName.end());
----------------
ChuanqiXu9 wrote:
This makes me slightly surprise. Could you explain why it is valid?
https://github.com/llvm/llvm-project/pull/90574
More information about the cfe-commits
mailing list