From: Sanjiv Gupta Date: Fri, 7 Aug 2009 11:00:02 +0000 (+0000) Subject: Minor fixes to avoid using invalid debugloc. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=394a1a21a197e27164d6393009e3c8e471e7b7fc Minor fixes to avoid using invalid debugloc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78383 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp index 0a44bfe2a5d..fd1940437fc 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -236,10 +236,11 @@ void PIC16DbgInfo::BeginFunction(const MachineFunction &MF) { // Retreive the first valid debug Loc and process it. const DebugLoc &DL = GetDebugLocForFunction(MF); - ChangeDebugLoc(MF, DL, true); - - EmitFunctBeginDI(MF.getFunction()); - + // Emit debug info only if valid debug info is available. + if (!DL.isUnknown()) { + ChangeDebugLoc(MF, DL, true); + EmitFunctBeginDI(MF.getFunction()); + } // Set current line to 0 so that.line directive is genearted after .bf. CurLine = 0; } @@ -271,7 +272,10 @@ void PIC16DbgInfo::SwitchToLine(unsigned Line, bool IsInBeginFunction) { /// void PIC16DbgInfo::EndFunction(const MachineFunction &MF) { if (! EmitDebugDirectives) return; - EmitFunctEndDI(MF.getFunction(), CurLine); + const DebugLoc &DL = GetDebugLocForFunction(MF); + // Emit debug info only if valid debug info is available. + if (!DL.isUnknown()) + EmitFunctEndDI(MF.getFunction(), CurLine); } /// EndModule - Emit .eof for end of module.