<div dir="ltr">Hi Eric,<div><br></div><div>Can you please sanity-check?</div><div>(The tests were landed as r204791 -- svn commits faster than I Ctrl+C...)</div><div><br></div><div>--</div><div>Thanks,</div><div>Timur</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-26 13:50 GMT+04:00 Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: timurrrr<br>
Date: Wed Mar 26 04:50:36 2014<br>
New Revision: 204790<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204790&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204790&view=rev</a><br>
Log:<br>
Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all<br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=204790&r1=204789&r2=204790&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=204790&r1=204789&r2=204790&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Wed Mar 26 04:50:36 2014<br>
@@ -131,9 +131,12 @@ void WinCodeViewLineTables::emitDebugInf<br>
   // For each function there is a separate subsection<br>
   // which holds the PC to file:line table.<br>
   const MCSymbol *Fn = Asm->getSymbol(GV);<br>
-  const FunctionInfo &FI = FnDebugInfo[GV];<br>
   assert(Fn);<br>
-  assert(FI.Instrs.size() > 0);<br>
+<br>
+  const FunctionInfo &FI = FnDebugInfo[GV];<br>
+  if (FI.Instrs.empty())<br>
+    return;<br>
+  assert(FI.End && "Don't know where the function ends?");<br>
<br>
   // PCs/Instructions are grouped into segments sharing the same filename.<br>
   // Pre-calculate the lengths (in instructions) of these segments and store<br>
@@ -264,12 +267,6 @@ void WinCodeViewLineTables::beginFunctio<br>
   if (!Asm || !Asm->MMI->hasDebugInfo())<br>
     return;<br>
<br>
-  // Grab the lexical scopes for the function, if we don't have any of those<br>
-  // then we're not going to be able to do anything.<br>
-  LScopes.initialize(*MF);<br>
-  if (LScopes.empty())<br>
-    return;<br>
-<br>
   const Function *GV = MF->getFunction();<br>
   assert(FnDebugInfo.count(GV) == false);<br>
   VisitedFunctions.push_back(GV);<br>
@@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(<br>
   if (!Asm || !CurFn)  // We haven't created any debug info for this function.<br>
     return;<br>
<br>
-  if (CurFn->Instrs.empty())<br>
-    llvm_unreachable("Can this ever happen?");<br>
-<br>
-  // Define end label for subprogram.<br>
-  MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();<br>
-  Asm->OutStreamer.EmitLabel(FunctionEndSym);<br>
-  CurFn->End = FunctionEndSym;<br>
+  if (!CurFn->Instrs.empty()) {<br>
+    // Define end label for subprogram.<br>
+    MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();<br>
+    Asm->OutStreamer.EmitLabel(FunctionEndSym);<br>
+    CurFn->End = FunctionEndSym;<br>
+  }<br>
   CurFn = 0;<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h?rev=204790&r1=204789&r2=204790&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h?rev=204790&r1=204789&r2=204790&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h Wed Mar 26 04:50:36 2014<br>
@@ -32,13 +32,13 @@ namespace llvm {<br>
 class WinCodeViewLineTables : public AsmPrinterHandler {<br>
   AsmPrinter *Asm;<br>
   DebugLoc PrevInstLoc;<br>
-  LexicalScopes LScopes;<br>
<br>
   // For each function, store a vector of labels to its instructions, as well as<br>
   // to the end of the function.<br>
   struct FunctionInfo {<br>
     SmallVector<MCSymbol *, 10> Instrs;<br>
     MCSymbol *End;<br>
+    FunctionInfo() : End(0) {}<br>
   } *CurFn;<br>
<br>
   typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>