//! Contains infrastructure for configuring the compiler, including parsing
//! command line options.
-pub use self::DebugInfoLevel::*;
-
use std::str::FromStr;
use session::{early_error, early_warn, Session};
}
#[derive(Clone, Copy, PartialEq, Hash)]
-pub enum DebugInfoLevel {
- NoDebugInfo,
- LimitedDebugInfo,
- FullDebugInfo,
+pub enum DebugInfo {
+ None,
+ Limited,
+ Full,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, RustcEncodable, RustcDecodable)]
// Include the debug_assertions flag into dependency tracking, since it
// can influence whether overflow checks are done or not.
debug_assertions: bool [TRACKED],
- debuginfo: DebugInfoLevel [TRACKED],
+ debuginfo: DebugInfo [TRACKED],
lint_opts: Vec<(String, lint::Level)> [TRACKED],
lint_cap: Option<lint::Level> [TRACKED],
describe_lints: bool [UNTRACKED],
Options {
crate_types: Vec::new(),
optimize: OptLevel::No,
- debuginfo: NoDebugInfo,
+ debuginfo: DebugInfo::None,
lint_opts: Vec::new(),
lint_cap: None,
describe_lints: false,
if cg.debuginfo.is_some() {
early_error(error_format, "-g and -C debuginfo both provided");
}
- FullDebugInfo
+ DebugInfo::Full
} else {
match cg.debuginfo {
- None | Some(0) => NoDebugInfo,
- Some(1) => LimitedDebugInfo,
- Some(2) => FullDebugInfo,
+ None | Some(0) => DebugInfo::None,
+ Some(1) => DebugInfo::Limited,
+ Some(2) => DebugInfo::Full,
Some(arg) => {
early_error(
error_format,
Some(m) => early_error(error_format, &format!("unknown borrowck mode `{}`", m)),
};
- if !cg.remark.is_empty() && debuginfo == NoDebugInfo {
+ if !cg.remark.is_empty() && debuginfo == DebugInfo::None {
early_warn(
error_format,
"-C remark will not show source locations without \
use std::hash::Hash;
use std::path::PathBuf;
use std::collections::hash_map::DefaultHasher;
- use super::{CrateType, DebugInfoLevel, ErrorOutputType, Lto, OptLevel, OutputTypes,
+ use super::{CrateType, DebugInfo, ErrorOutputType, Lto, OptLevel, OutputTypes,
Passes, Sanitizer, CrossLangLto};
use syntax::feature_gate::UnstableFeatures;
use rustc_target::spec::{PanicStrategy, RelroLevel, TargetTriple};
impl_dep_tracking_hash_via_hash!(Passes);
impl_dep_tracking_hash_via_hash!(OptLevel);
impl_dep_tracking_hash_via_hash!(Lto);
- impl_dep_tracking_hash_via_hash!(DebugInfoLevel);
+ impl_dep_tracking_hash_via_hash!(DebugInfo);
impl_dep_tracking_hash_via_hash!(UnstableFeatures);
impl_dep_tracking_hash_via_hash!(OutputTypes);
impl_dep_tracking_hash_via_hash!(cstore::NativeLibraryKind);
use super::rpath::RPathConfig;
use super::rpath;
use metadata::METADATA_FILENAME;
-use rustc::session::config::{self, NoDebugInfo, OutputFilenames, OutputType, PrintRequest};
+use rustc::session::config::{self, DebugInfo, OutputFilenames, OutputType, PrintRequest};
use rustc::session::config::{RUST_CGU_EXT, Lto};
use rustc::session::filesearch;
use rustc::session::search_paths::PathKind;
/// split-dwarf like schemes.
fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool {
// If the objects don't have debuginfo there's nothing to preserve.
- if sess.opts.debuginfo == NoDebugInfo {
+ if sess.opts.debuginfo == DebugInfo::None {
return false
}
// the symbols. Note, though, that if the object files are being preserved
// for their debug information there's no need for us to run dsymutil.
if sess.target.target.options.is_like_osx &&
- sess.opts.debuginfo != NoDebugInfo &&
+ sess.opts.debuginfo != DebugInfo::None &&
!preserve_objects_for_their_debuginfo(sess)
{
match Command::new("dsymutil").arg(out_filename).output() {
use rustc::hir::def_id::{LOCAL_CRATE, CrateNum};
use rustc::middle::dependency_format::Linkage;
use rustc::session::Session;
-use rustc::session::config::{self, CrateType, OptLevel, DebugInfoLevel,
+use rustc::session::config::{self, CrateType, OptLevel, DebugInfo,
CrossLangLto};
use rustc::ty::TyCtxt;
use rustc_target::spec::{LinkerFlavor, LldFlavor};
fn debuginfo(&mut self) {
match self.sess.opts.debuginfo {
- DebugInfoLevel::NoDebugInfo => {
+ DebugInfo::None => {
// If we are building without debuginfo enabled and we were called with
// `-Zstrip-debuginfo-if-disabled=yes`, tell the linker to strip any debuginfo
// found when linking to get rid of symbols from libstd.
fn debuginfo(&mut self) {
// Preserve names or generate source maps depending on debug info
self.cmd.arg(match self.sess.opts.debuginfo {
- DebugInfoLevel::NoDebugInfo => "-g0",
- DebugInfoLevel::LimitedDebugInfo => "-g3",
- DebugInfoLevel::FullDebugInfo => "-g4"
+ DebugInfo::None => "-g0",
+ DebugInfo::Limited => "-g3",
+ DebugInfo::Full => "-g4"
});
}
pub tm_factory: Arc<dyn Fn() -> Result<&'static mut llvm::TargetMachine, String> + Send + Sync>,
pub msvc_imps_needed: bool,
pub target_pointer_width: String,
- debuginfo: config::DebugInfoLevel,
+ debuginfo: config::DebugInfo,
// Number of cgus excluding the allocator/metadata modules
pub total_cgus: usize,
use rustc::middle::exported_symbols;
use rustc::util::common::{time, print_time_passes_entry};
use rustc::util::profiling::ProfileCategory;
-use rustc::session::config::{self, NoDebugInfo, EntryFnType};
+use rustc::session::config::{self, DebugInfo, EntryFnType};
use rustc::session::Session;
use rustc_incremental;
use allocator;
}
// Finalize debuginfo
- if cx.sess().opts.debuginfo != NoDebugInfo {
+ if cx.sess().opts.debuginfo != DebugInfo::None {
debuginfo::finalize(&cx);
}
use rustc_data_structures::base_n;
use rustc::mir::mono::Stats;
-use rustc::session::config::{self, NoDebugInfo};
+use rustc::session::config::{self, DebugInfo};
use rustc::session::Session;
use rustc::ty::layout::{LayoutError, LayoutOf, Size, TyLayout};
use rustc::ty::{self, Ty, TyCtxt};
let (llcx, llmod) = (&*llvm_module.llcx, llvm_module.llmod());
- let dbg_cx = if tcx.sess.opts.debuginfo != NoDebugInfo {
+ let dbg_cx = if tcx.sess.opts.debuginfo != DebugInfo::None {
let dctx = debuginfo::CrateDebugContext::new(llmod);
debuginfo::metadata::compile_unit_metadata(tcx,
&codegen_unit.name().as_str(),
ifn!("llvm.assume", fn(i1) -> void);
ifn!("llvm.prefetch", fn(i8p, t_i32, t_i32, t_i32) -> void);
- if cx.sess().opts.debuginfo != NoDebugInfo {
+ if cx.sess().opts.debuginfo != DebugInfo::None {
ifn!("llvm.dbg.declare", fn(Type::metadata(cx), Type::metadata(cx)) -> void);
ifn!("llvm.dbg.value", fn(Type::metadata(cx), t_i64, Type::metadata(cx)) -> void);
}
use common::{C_bytes, CodegenCx, C_i32};
use builder::Builder;
use declare;
-use rustc::session::config::NoDebugInfo;
+use rustc::session::config::DebugInfo;
use type_::Type;
use value::Value;
"omit_gdb_pretty_printer_section");
!omit_gdb_pretty_printer_section &&
- cx.sess().opts.debuginfo != NoDebugInfo &&
+ cx.sess().opts.debuginfo != DebugInfo::None &&
cx.sess().target.target.options.emit_debug_gdb_scripts
}
use monomorphize::Instance;
use rustc::ty::{self, ParamEnv, Ty, InstanceDef};
use rustc::mir;
-use rustc::session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
+use rustc::session::config::{self, DebugInfo};
use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet};
use value::Value;
llfn: &'ll Value,
mir: &mir::Mir,
) -> FunctionDebugContext<'ll> {
- if cx.sess().opts.debuginfo == NoDebugInfo {
+ if cx.sess().opts.debuginfo == DebugInfo::None {
return FunctionDebugContext::DebugInfoDisabled;
}
cx: &CodegenCx<'ll, 'tcx>,
sig: ty::FnSig<'tcx>,
) -> &'ll DIArray {
- if cx.sess().opts.debuginfo == LimitedDebugInfo {
+ if cx.sess().opts.debuginfo == DebugInfo::Limited {
return create_DIArray(DIB(cx), &[]);
}
name_to_append_suffix_to.push('>');
// Again, only create type information if full debuginfo is enabled
- let template_params: Vec<_> = if cx.sess().opts.debuginfo == FullDebugInfo {
+ let template_params: Vec<_> = if cx.sess().opts.debuginfo == DebugInfo::Full {
let names = get_parameter_names(cx, generics);
substs.iter().zip(names).filter_map(|(kind, name)| {
if let UnpackedKind::Type(ty) = kind.unpack() {
use rustc::ty::layout::{LayoutOf, TyLayout};
use rustc::mir::{self, Mir};
use rustc::ty::subst::Substs;
-use rustc::session::config::FullDebugInfo;
+use rustc::session::config::DebugInfo;
use base;
use builder::Builder;
use common::{CodegenCx, Funclet};
if let Some(name) = decl.name {
// User variable
let debug_scope = fx.scopes[decl.visibility_scope];
- let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo;
+ let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == DebugInfo::Full;
if !memory_locals.contains(local) && !dbg {
debug!("alloc: {:?} ({}) -> operand", local, name);
// Get the argument scope, if it exists and if we need it.
let arg_scope = scopes[mir::OUTERMOST_SOURCE_SCOPE];
- let arg_scope = if bx.sess().opts.debuginfo == FullDebugInfo {
+ let arg_scope = if bx.sess().opts.debuginfo == DebugInfo::Full {
arg_scope.scope_metadata
} else {
None
use rustc::ty::TyCtxt;
use rustc::mir::*;
use rustc::mir::visit::{MutVisitor, Visitor, PlaceContext};
-use rustc::session::config::FullDebugInfo;
+use rustc::session::config::DebugInfo;
use std::borrow::Cow;
use transform::{MirPass, MirSource};
}
// We may need to keep dead user variables live for debuginfo.
- if tcx.sess.opts.debuginfo == FullDebugInfo {
+ if tcx.sess.opts.debuginfo == DebugInfo::Full {
for local in mir.vars_iter() {
marker.locals.insert(local);
}