public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7661] gccrs: expand: Remove proc macro fragment from expander
@ 2024-01-16 17:51 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 17:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c7805016c877680238a80c2318c6366789fb521a

commit r14-7661-gc7805016c877680238a80c2318c6366789fb521a
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Jun 5 15:21:15 2023 +0200

    gccrs: expand: Remove proc macro fragment from expander
    
    Procedural macros are no longer expanded on post order but rather
    expanded from their parent. Hence they are no longer stored in the
    expander which means this attribute can be removed. This commit also
    remove the old expansion mechanism.
    
    gcc/rust/ChangeLog:
    
            * expand/rust-expand-visitor.h: Remove fragment collection fro
            procedural macros.
            * expand/rust-macro-expand.h (struct MacroExpander): Remove
            procedural macro fragment from expander.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/expand/rust-expand-visitor.h | 15 ---------------
 gcc/rust/expand/rust-macro-expand.h   | 18 ------------------
 2 files changed, 33 deletions(-)

diff --git a/gcc/rust/expand/rust-expand-visitor.h b/gcc/rust/expand/rust-expand-visitor.h
index d86f0d03856..d1bdd8a820a 100644
--- a/gcc/rust/expand/rust-expand-visitor.h
+++ b/gcc/rust/expand/rust-expand-visitor.h
@@ -127,8 +127,6 @@ public:
 	value->accept_vis (*this);
 
 	auto final_fragment = expander.take_expanded_fragment ();
-	auto proc_macro_fragment
-	  = expander.take_expanded_proc_macro_fragment ();
 
 	// FIXME: Is that correct? It seems *extremely* dodgy
 	if (final_fragment.should_expand ())
@@ -144,19 +142,6 @@ public:
 		  }
 	      }
 	  }
-	else if (proc_macro_fragment.should_expand ())
-	  {
-	    it = values.erase (it);
-	    for (auto &node : proc_macro_fragment.get_nodes ())
-	      {
-		auto new_node = extractor (node);
-		if (new_node != nullptr)
-		  {
-		    it = values.insert (it, std::move (new_node));
-		    it++;
-		  }
-	      }
-	  }
 	else
 	  {
 	    ++it;
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index 4274c124a25..676a9d14790 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -236,7 +236,6 @@ struct MacroExpander
     : cfg (cfg), crate (crate), session (session),
       sub_stack (SubstitutionScope ()),
       expanded_fragment (AST::Fragment::create_error ()),
-      expanded_proc_macro_fragment (AST::Fragment::create_error ()),
       has_changed_flag (false), resolver (Resolver::Resolver::get ()),
       mappings (Analysis::Mappings::get ())
   {}
@@ -338,22 +337,6 @@ struct MacroExpander
     return fragment;
   }
 
-  void set_expanded_proc_macro_fragment (AST::Fragment &&fragment)
-  {
-    if (!fragment.is_error ())
-      has_changed_flag = true;
-
-    expanded_proc_macro_fragment = std::move (fragment);
-  }
-
-  AST::Fragment take_expanded_proc_macro_fragment ()
-  {
-    auto fragment = std::move (expanded_proc_macro_fragment);
-    expanded_proc_macro_fragment = AST::Fragment::create_error ();
-
-    return fragment;
-  }
-
   void import_proc_macros (std::string extern_crate);
 
   template <typename T>
@@ -479,7 +462,6 @@ private:
   SubstitutionScope sub_stack;
   std::vector<ContextType> context;
   AST::Fragment expanded_fragment;
-  AST::Fragment expanded_proc_macro_fragment;
   bool has_changed_flag;
 
   AST::MacroRulesDefinition *last_def;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 17:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 17:51 [gcc r14-7661] gccrs: expand: Remove proc macro fragment from expander Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).