summaryrefslogtreecommitdiff
path: root/src/expand/rustc_diagnostics.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-26 10:48:14 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-26 10:48:14 +0800
commit477c555476244cff4809e79ae204a6fe90b07033 (patch)
tree339b3bb8a55e549c657cd9ae56a2ed2120ddd2a5 /src/expand/rustc_diagnostics.cpp
parent9fc7a883831b9186b666e2f9addc81c6d8a8d5b2 (diff)
downloadmrust-477c555476244cff4809e79ae204a6fe90b07033.tar.gz
Expand - Add a stubbed impl of some rustc-internal macros
Diffstat (limited to 'src/expand/rustc_diagnostics.cpp')
-rw-r--r--src/expand/rustc_diagnostics.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/expand/rustc_diagnostics.cpp b/src/expand/rustc_diagnostics.cpp
new file mode 100644
index 00000000..e9990a93
--- /dev/null
+++ b/src/expand/rustc_diagnostics.cpp
@@ -0,0 +1,30 @@
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * expand/rustc_diagnostics.cpp
+ * - Stubbed handling for __register_diagnostic and __diagnostic_used
+ */
+#include <synext.hpp>
+#include <parse/common.hpp> // TokenTree etc
+
+class CExpanderRegisterDiagnostic:
+ public ExpandProcMacro
+{
+ ::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
+ {
+ return box$( TTStreamO(TokenTree()) );
+ }
+};
+class CExpanderDiagnosticUsed:
+ public ExpandProcMacro
+{
+ ::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
+ {
+ return box$( TTStreamO(TokenTree()) );
+ }
+};
+
+STATIC_MACRO("__register_diagnostic", CExpanderRegisterDiagnostic)
+STATIC_MACRO("__diagnostic_used", CExpanderDiagnosticUsed)
+