aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-expand.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.h')
-rw-r--r--gcc/rust/expand/rust-macro-expand.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index 1102565..2e9b88b 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -20,6 +20,7 @@
#define RUST_MACRO_EXPAND_H
#include "rust-ast.h"
+#include "rust-macro.h"
// Provides objects and method prototypes for macro expansion
@@ -34,9 +35,9 @@ struct ExpansionCfg
{
// features?
unsigned int recursion_limit = 50; // TODO: determine default recursion limit
- // trace macros?
- // should test?
- // more default stuff?
+ // trace macros?
+ // should test?
+ // more default stuff?
};
// Object used to store shared data (between functions) for macro expansion.
@@ -59,11 +60,18 @@ struct MacroExpander
// should this be public or private?
void expand_invoc (std::unique_ptr<AST::MacroInvocation> &invoc);
+ // Expands a single declarative macro.
+ AST::ASTFragment expand_decl_macro (AST::MacroInvocData &invoc,
+ AST::MacroRulesDefinition &rules_def);
+
void expand_cfg_attrs (std::vector<AST::Attribute> &attrs);
- bool fails_cfg (std::vector<AST::Attribute> &attr);
+ bool fails_cfg (const std::vector<AST::Attribute> &attr) const;
+ bool fails_cfg_with_expand (std::vector<AST::Attribute> &attrs) const;
- /* TODO: make it extend ASTVisitor so that individual items can be accessed
- * properly? */
+ // Expand the data of a cfg! macro.
+ void parse_macro_to_meta_item (AST::MacroInvocData &invoc);
+ // Get the literal representation of a cfg! macro.
+ AST::Literal expand_cfg_macro (AST::MacroInvocData &invoc);
private:
AST::Crate &crate;