about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2016-05-29 14:57:34 +0530
committerSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2016-05-29 14:57:34 +0530
commit593e1567cac93b3ed60b37cb37cdf60b04182b4d (patch)
tree8ca43c4f33ebb546427ec4fad66536c5056da874
parent397cfaec0ce28289b0ab04ed6f6c3ba6ee1042ea (diff)
downloadrust-593e1567cac93b3ed60b37cb37cdf60b04182b4d.tar.gz
rust-593e1567cac93b3ed60b37cb37cdf60b04182b4d.zip
run rustfmt on librustc_llvm folder
-rw-r--r--src/librustc_llvm/archive_ro.rs29
-rw-r--r--src/librustc_llvm/build.rs61
-rw-r--r--src/librustc_llvm/diagnostic.rs49
3 files changed, 83 insertions, 56 deletions
diff --git a/src/librustc_llvm/archive_ro.rs b/src/librustc_llvm/archive_ro.rs
index be7f0ed6a02..b3f5f8e5360 100644
--- a/src/librustc_llvm/archive_ro.rs
+++ b/src/librustc_llvm/archive_ro.rs
@@ -18,7 +18,9 @@ use std::path::Path;
 use std::slice;
 use std::str;
 
-pub struct ArchiveRO { ptr: ArchiveRef }
+pub struct ArchiveRO {
+    ptr: ArchiveRef,
+}
 
 pub struct Iter<'a> {
     archive: &'a ArchiveRO,
@@ -61,11 +63,16 @@ impl ArchiveRO {
         }
     }
 
-    pub fn raw(&self) -> ArchiveRef { self.ptr }
+    pub fn raw(&self) -> ArchiveRef {
+        self.ptr
+    }
 
     pub fn iter(&self) -> Iter {
         unsafe {
-            Iter { ptr: ::LLVMRustArchiveIteratorNew(self.ptr), archive: self }
+            Iter {
+                ptr: ::LLVMRustArchiveIteratorNew(self.ptr),
+                archive: self,
+            }
         }
     }
 }
@@ -86,7 +93,10 @@ impl<'a> Iterator for Iter<'a> {
         if ptr.is_null() {
             ::last_error().map(Err)
         } else {
-            Some(Ok(Child { ptr: ptr, _data: marker::PhantomData }))
+            Some(Ok(Child {
+                ptr: ptr,
+                _data: marker::PhantomData,
+            }))
         }
     }
 }
@@ -107,8 +117,7 @@ impl<'a> Child<'a> {
             if name_ptr.is_null() {
                 None
             } else {
-                let name = slice::from_raw_parts(name_ptr as *const u8,
-                                                 name_len as usize);
+                let name = slice::from_raw_parts(name_ptr as *const u8, name_len as usize);
                 str::from_utf8(name).ok().map(|s| s.trim())
             }
         }
@@ -125,11 +134,15 @@ impl<'a> Child<'a> {
         }
     }
 
-    pub fn raw(&self) -> ::ArchiveChildRef { self.ptr }
+    pub fn raw(&self) -> ::ArchiveChildRef {
+        self.ptr
+    }
 }
 
 impl<'a> Drop for Child<'a> {
     fn drop(&mut self) {
-        unsafe { ::LLVMRustArchiveChildFree(self.ptr); }
+        unsafe {
+            ::LLVMRustArchiveChildFree(self.ptr);
+        }
     }
 }
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 0c6db2cb8ba..250aafd77a8 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -21,20 +21,25 @@ fn main() {
     println!("cargo:rustc-cfg=cargobuild");
 
     let target = env::var("TARGET").unwrap();
-    let llvm_config = env::var_os("LLVM_CONFIG").map(PathBuf::from)
-                           .unwrap_or_else(|| {
-        match env::var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
-            Some(dir) => {
-                let to_test = dir.parent().unwrap().parent().unwrap()
-                                 .join(&target).join("llvm/bin/llvm-config");
-                if Command::new(&to_test).output().is_ok() {
-                    return to_test
-                }
-            }
-            None => {}
-        }
-        PathBuf::from("llvm-config")
-    });
+    let llvm_config = env::var_os("LLVM_CONFIG")
+                          .map(PathBuf::from)
+                          .unwrap_or_else(|| {
+                              match env::var_os("CARGO_TARGET_DIR").map(PathBuf::from) {
+                                  Some(dir) => {
+                                      let to_test = dir.parent()
+                                                       .unwrap()
+                                                       .parent()
+                                                       .unwrap()
+                                                       .join(&target)
+                                                       .join("llvm/bin/llvm-config");
+                                      if Command::new(&to_test).output().is_ok() {
+                                          return to_test;
+                                      }
+                                  }
+                                  None => {}
+                              }
+                              PathBuf::from("llvm-config")
+                          });
 
     println!("cargo:rerun-if-changed={}", llvm_config.display());
 
@@ -63,20 +68,22 @@ fn main() {
     let host = env::var("HOST").unwrap();
     let is_crossed = target != host;
 
-    let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc",
-                               "pnacl"];
+    let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc", "pnacl"];
 
     // FIXME: surely we don't need all these components, right? Stuff like mcjit
     //        or interpreter the compiler itself never uses.
-    let required_components = &["ipo", "bitreader", "bitwriter", "linker",
-                                "asmparser", "mcjit", "interpreter",
+    let required_components = &["ipo",
+                                "bitreader",
+                                "bitwriter",
+                                "linker",
+                                "asmparser",
+                                "mcjit",
+                                "interpreter",
                                 "instrumentation"];
 
     let components = output(Command::new(&llvm_config).arg("--components"));
     let mut components = components.split_whitespace().collect::<Vec<_>>();
-    components.retain(|c| {
-        optional_components.contains(c) || required_components.contains(c)
-    });
+    components.retain(|c| optional_components.contains(c) || required_components.contains(c));
 
     for component in required_components {
         if !components.contains(component) {
@@ -96,7 +103,7 @@ fn main() {
     for flag in cxxflags.split_whitespace() {
         // Ignore flags like `-m64` when we're doing a cross build
         if is_crossed && flag.starts_with("-m") {
-            continue
+            continue;
         }
         cfg.flag(flag);
     }
@@ -131,7 +138,7 @@ fn main() {
         } else if lib.starts_with("-") {
             &lib[1..]
         } else {
-            continue
+            continue;
         };
 
         // Don't need or want this library, but LLVM's CMake build system
@@ -140,10 +147,14 @@ fn main() {
         // library and it otherwise may just pull in extra dependencies on
         // libedit which we don't want
         if name == "LLVMLineEditor" {
-            continue
+            continue;
         }
 
-        let kind = if name.starts_with("LLVM") {"static"} else {"dylib"};
+        let kind = if name.starts_with("LLVM") {
+            "static"
+        } else {
+            "dylib"
+        };
         println!("cargo:rustc-link-lib={}={}", kind, name);
     }
 
diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs
index acb47516150..44e01561464 100644
--- a/src/librustc_llvm/diagnostic.rs
+++ b/src/librustc_llvm/diagnostic.rs
@@ -16,7 +16,7 @@ pub use self::Diagnostic::*;
 use libc::{c_char, c_uint};
 use std::ptr;
 
-use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
+use {DebugLocRef, DiagnosticInfoRef, TwineRef, ValueRef};
 
 #[derive(Copy, Clone)]
 pub enum OptimizationDiagnosticKind {
@@ -46,8 +46,9 @@ pub struct OptimizationDiagnostic {
 }
 
 impl OptimizationDiagnostic {
-    unsafe fn unpack(kind: OptimizationDiagnosticKind, di: DiagnosticInfoRef)
-            -> OptimizationDiagnostic {
+    unsafe fn unpack(kind: OptimizationDiagnosticKind,
+                     di: DiagnosticInfoRef)
+                     -> OptimizationDiagnostic {
 
         let mut opt = OptimizationDiagnostic {
             kind: kind,
@@ -58,10 +59,10 @@ impl OptimizationDiagnostic {
         };
 
         super::LLVMUnpackOptimizationDiagnostic(di,
-            &mut opt.pass_name,
-            &mut opt.function,
-            &mut opt.debug_loc,
-            &mut opt.message);
+                                                &mut opt.pass_name,
+                                                &mut opt.function,
+                                                &mut opt.debug_loc,
+                                                &mut opt.message);
 
         opt
     }
@@ -75,8 +76,7 @@ pub struct InlineAsmDiagnostic {
 }
 
 impl InlineAsmDiagnostic {
-    unsafe fn unpack(di: DiagnosticInfoRef)
-            -> InlineAsmDiagnostic {
+    unsafe fn unpack(di: DiagnosticInfoRef) -> InlineAsmDiagnostic {
 
         let mut opt = InlineAsmDiagnostic {
             cookie: 0,
@@ -85,9 +85,9 @@ impl InlineAsmDiagnostic {
         };
 
         super::LLVMUnpackInlineAsmDiagnostic(di,
-            &mut opt.cookie,
-            &mut opt.message,
-            &mut opt.instruction);
+                                             &mut opt.cookie,
+                                             &mut opt.message,
+                                             &mut opt.instruction);
 
         opt
     }
@@ -106,22 +106,25 @@ impl Diagnostic {
         let kind = super::LLVMGetDiagInfoKind(di);
 
         match kind {
-            super::DK_InlineAsm
-                => InlineAsm(InlineAsmDiagnostic::unpack(di)),
+            super::DK_InlineAsm => InlineAsm(InlineAsmDiagnostic::unpack(di)),
 
-            super::DK_OptimizationRemark
-                => Optimization(OptimizationDiagnostic::unpack(OptimizationRemark, di)),
+            super::DK_OptimizationRemark => {
+                Optimization(OptimizationDiagnostic::unpack(OptimizationRemark, di))
+            }
 
-            super::DK_OptimizationRemarkMissed
-                => Optimization(OptimizationDiagnostic::unpack(OptimizationMissed, di)),
+            super::DK_OptimizationRemarkMissed => {
+                Optimization(OptimizationDiagnostic::unpack(OptimizationMissed, di))
+            }
 
-            super::DK_OptimizationRemarkAnalysis
-                => Optimization(OptimizationDiagnostic::unpack(OptimizationAnalysis, di)),
+            super::DK_OptimizationRemarkAnalysis => {
+                Optimization(OptimizationDiagnostic::unpack(OptimizationAnalysis, di))
+            }
 
-            super::DK_OptimizationFailure
-                => Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di)),
+            super::DK_OptimizationFailure => {
+                Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di))
+            }
 
-            _ => UnknownDiagnostic(di)
+            _ => UnknownDiagnostic(di),
         }
     }
 }