[clang] [Clang] Implement P3034R1 Module Declarations Shouldn’t be Macros (PR #90574)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 06:04:30 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());
----------------
yronglin wrote:
Agree 100% , I've added more comments in code.
https://github.com/llvm/llvm-project/pull/90574
More information about the cfe-commits
mailing list