Fortify dummy span checking

This commit is contained in:
Vadim Petrochenkov 2018-06-25 01:00:21 +03:00
parent 297109ea32
commit 9f92fce77c
21 changed files with 59 additions and 59 deletions

View file

@ -1662,7 +1662,7 @@ pub fn create_global_var_metadata(cx: &CodegenCx,
let var_scope = get_namespace_for_item(cx, def_id);
let span = tcx.def_span(def_id);
let (file_metadata, line_number) = if span != syntax_pos::DUMMY_SP {
let (file_metadata, line_number) = if !span.is_dummy() {
let loc = span_start(cx, span);
(file_metadata(cx, &loc.file.name, LOCAL_CRATE), loc.line as c_uint)
} else {

View file

@ -219,7 +219,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
let span = mir.span;
// This can be the case for functions inlined from another crate
if span == syntax_pos::DUMMY_SP {
if span.is_dummy() {
// FIXME(simulacrum): Probably can't happen; remove.
return FunctionDebugContext::FunctionWithoutDebugInfo;
}