about summary refs log tree commit diff
path: root/src/comp/lib
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-09-12 11:27:30 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-09-12 12:04:14 +0200
commitfc6b7c8b381bcb506eab0f50c69b6cc18aafacb2 (patch)
treec3511313bdb6c7cc8919426ce980e558396fe92c /src/comp/lib
parent64a6376da5ef6e40870af77410d3542ff7bab140 (diff)
downloadrust-fc6b7c8b381bcb506eab0f50c69b6cc18aafacb2.tar.gz
rust-fc6b7c8b381bcb506eab0f50c69b6cc18aafacb2.zip
Reformat for new mode syntax, step 1
Long lines were fixed in a very crude way, as I'll be following up
with another reformat in a bit.
Diffstat (limited to 'src/comp/lib')
-rw-r--r--src/comp/lib/llvm.rs45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs
index 431893b0201..8abdb8560f7 100644
--- a/src/comp/lib/llvm.rs
+++ b/src/comp/lib/llvm.rs
@@ -809,15 +809,19 @@ native "cdecl" mod llvm = "rustllvm" {
                                                    Value: Bool);
     fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef,
                                                    Value: Bool);
-    fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls(
-        PMB: PassManagerBuilderRef, Value: Bool);
-    fn LLVMPassManagerBuilderUseInlinerWithThreshold(
-        PMB: PassManagerBuilderRef, threshold: uint);
-    fn LLVMPassManagerBuilderPopulateModulePassManager(
-        PMB: PassManagerBuilderRef, PM: PassManagerRef);
-
-    fn LLVMPassManagerBuilderPopulateFunctionPassManager(
-        PMB: PassManagerBuilderRef, PM: PassManagerRef);
+    fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls
+        (PMB: PassManagerBuilderRef,
+                                                        Value: Bool);
+    fn LLVMPassManagerBuilderUseInlinerWithThreshold
+        (PMB: PassManagerBuilderRef,
+                                                     threshold: uint);
+    fn LLVMPassManagerBuilderPopulateModulePassManager(PMB:
+                                                        PassManagerBuilderRef,
+                                                       PM: PassManagerRef);
+
+    fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB:
+                                                        PassManagerBuilderRef,
+                                                         PM: PassManagerRef);
 
     /** Destroys a memory buffer. */
     fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef);
@@ -898,7 +902,7 @@ native "cdecl" mod llvm = "rustllvm" {
 obj type_names(type_names: std::map::hashmap<TypeRef, str>,
                named_types: std::map::hashmap<str, TypeRef>) {
 
-    fn associate(s: &str, t: TypeRef) {
+    fn associate(s: str, t: TypeRef) {
         assert (!named_types.contains_key(s));
         assert (!type_names.contains_key(t));
         type_names.insert(t, s);
@@ -909,17 +913,17 @@ obj type_names(type_names: std::map::hashmap<TypeRef, str>,
 
     fn get_name(t: TypeRef) -> str { ret type_names.get(t); }
 
-    fn name_has_type(s: &str) -> bool { ret named_types.contains_key(s); }
+    fn name_has_type(s: str) -> bool { ret named_types.contains_key(s); }
 
-    fn get_type(s: &str) -> TypeRef { ret named_types.get(s); }
+    fn get_type(s: str) -> TypeRef { ret named_types.get(s); }
 }
 
 fn mk_type_names() -> type_names {
     let nt = std::map::new_str_hash::<TypeRef>();
 
-    fn hash(t: &TypeRef) -> uint { ret t as uint; }
+    fn hash(t: TypeRef) -> uint { ret t as uint; }
 
-    fn eq(a: &TypeRef, b: &TypeRef) -> bool { ret a as uint == b as uint; }
+    fn eq(a: TypeRef, b: TypeRef) -> bool { ret a as uint == b as uint; }
 
     let hasher: std::map::hashfn<TypeRef> = hash;
     let eqer: std::map::eqfn<TypeRef> = eq;
@@ -932,7 +936,7 @@ fn type_to_str(names: type_names, ty: TypeRef) -> str {
     ret type_to_str_inner(names, [], ty);
 }
 
-fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
+fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
    str {
 
     if names.type_has_name(ty) { ret names.get_name(ty); }
@@ -941,7 +945,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
     let kind: int = llvm::LLVMGetTypeKind(ty);
 
-    fn tys_str(names: type_names, outer: &[TypeRef], tys: &[TypeRef]) -> str {
+    fn tys_str(names: type_names, outer: [TypeRef], tys: [TypeRef]) -> str {
         let s: str = "";
         let first: bool = true;
         for t: TypeRef in tys {
@@ -957,6 +961,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       // FIXME: more enum-as-int constants determined from Core::h;
       // horrible, horrible. Complete as needed.
 
@@ -973,6 +978,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       7 {
         ret "i" + std::int::str(llvm::LLVMGetIntTypeWidth(ty) as int);
       }
@@ -980,6 +986,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       8 {
         let s = "fn(";
         let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
@@ -995,6 +1002,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       9 {
         let s: str = "{";
         let n_elts: uint = llvm::LLVMCountStructElementTypes(ty);
@@ -1008,6 +1016,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       10 {
         let el_ty = llvm::LLVMGetElementType(ty);
         ret "[" + type_to_str_inner(names, outer, el_ty) + "]";
@@ -1016,6 +1025,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       11 {
         let i: uint = 0u;
         for tout: TypeRef in outer0 {
@@ -1032,6 +1042,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) ->
 
 
 
+
       12 {
         ret "Opaque";
       }
@@ -1066,7 +1077,7 @@ resource target_data_res(TD: TargetDataRef) {
 
 type target_data = {lltd: TargetDataRef, dtor: @target_data_res};
 
-fn mk_target_data(string_rep: &str) -> target_data {
+fn mk_target_data(string_rep: str) -> target_data {
     let lltd =
         str::as_buf(string_rep, {|buf| llvm::LLVMCreateTargetData(buf) });
     ret {lltd: lltd, dtor: @target_data_res(lltd)};