summary refs log tree commit diff
path: root/src/test/run-make/llvm-pass/plugin.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-02-14 22:57:43 -0500
committerCorey Farwell <coreyf@rwell.org>2016-02-15 10:08:04 -0500
commita60ec05fdc1bf51c6d96fa60876be2c8e2aa1b1e (patch)
treeae4870e1886e15cf9aa631dc957cfc82daa732fa /src/test/run-make/llvm-pass/plugin.rs
parent2808df961bf218dc1844a61efc1906ffdf2808a8 (diff)
downloadrust-a60ec05fdc1bf51c6d96fa60876be2c8e2aa1b1e.tar.gz
rust-a60ec05fdc1bf51c6d96fa60876be2c8e2aa1b1e.zip
Add LLVM FunctionPass regression test using run-make.
Part of https://github.com/rust-lang/rust/issues/31185.

Similar to https://github.com/rust-lang/rust/pull/31391.
Diffstat (limited to 'src/test/run-make/llvm-pass/plugin.rs')
-rw-r--r--src/test/run-make/llvm-pass/plugin.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/run-make/llvm-pass/plugin.rs b/src/test/run-make/llvm-pass/plugin.rs
new file mode 100644
index 00000000000..f77b2fca857
--- /dev/null
+++ b/src/test/run-make/llvm-pass/plugin.rs
@@ -0,0 +1,28 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(plugin_registrar, rustc_private)]
+#![crate_type = "dylib"]
+#![crate_name = "some_plugin"]
+
+extern crate rustc;
+extern crate rustc_plugin;
+
+#[link(name = "llvm-function-pass", kind = "static")]
+#[link(name = "llvm-module-pass", kind = "static")]
+extern {}
+
+use rustc_plugin::registry::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+    reg.register_llvm_pass("some-llvm-function-pass");
+    reg.register_llvm_pass("some-llvm-module-pass");
+}