[llvm] r204790 - Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all

Eric Christopher echristo at gmail.com
Mon Mar 31 17:12:34 PDT 2014


> -  // Grab the lexical scopes for the function, if we don't have any of those
> -  // then we're not going to be able to do anything.
> -  LScopes.initialize(*MF);
> -  if (LScopes.empty())
> -    return;
> -
>    const Function *GV = MF->getFunction();
>    assert(FnDebugInfo.count(GV) == false);
>    VisitedFunctions.push_back(GV);
> @@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(
>    if (!Asm || !CurFn)  // We haven't created any debug info for this function.
>      return;
>
> -  if (CurFn->Instrs.empty())
> -    llvm_unreachable("Can this ever happen?");
> -
> -  // Define end label for subprogram.
> -  MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
> -  Asm->OutStreamer.EmitLabel(FunctionEndSym);
> -  CurFn->End = FunctionEndSym;
> +  if (!CurFn->Instrs.empty()) {
> +    // Define end label for subprogram.
> +    MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
> +    Asm->OutStreamer.EmitLabel(FunctionEndSym);
> +    CurFn->End = FunctionEndSym;
> +  }
>    CurFn = 0;
>  }

This part doesn't really make sense. You're saying that without any
scope we can still generate a line table entry for this? What's the
information contained within and how did it get line information on
there? I might be missing something though.

I'm not sure what kind of code this is supposed to be catching (and I
looked at the testcases :)

-eric



More information about the llvm-commits mailing list