[cfe-commits] PATCH : Function Start Debug Info

Sanjiv.Gupta at microchip.com Sanjiv.Gupta at microchip.com
Fri May 16 09:06:41 PDT 2008


Thanks Devang.
 
-Sanjiv

________________________________

From: Devang Patel [mailto:dpatel at apple.com]
Sent: Fri 5/16/2008 9:35 PM
To: Sanjiv Kumar Gupta - I00171
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] PATCH : Function Start Debug Info



On May 12, 2008, at 5:26 AM, Sanjiv.Gupta at microchip.com wrote:

> Please find the patch attached for generating function start debug 
> info.
> Index: lib/CodeGen/CodeGenFunction.cpp
> ===================================================================
> --- lib/CodeGen/CodeGenFunction.cpp   (revision 50963)
> +++ lib/CodeGen/CodeGenFunction.cpp   (working copy)
> @@ -11,6 +11,7 @@
>  //
>  //
> =
> =
> =
> ----------------------------------------------------------------------=
> ==//
>
> +#include "CGDebugInfo.h"
>  #include "CodeGenFunction.h"
>  #include "CodeGenModule.h"
>  #include "clang/Basic/TargetInfo.h"
> @@ -197,7 +198,15 @@
>                                           EntryBB);
>
>    Builder.SetInsertPoint(EntryBB);
> -
> +
> +  CGDebugInfo *DI = CGM.getDebugInfo();
> +  if (DI && FD->getBody()) {
> +      if (FD->getLocation().isValid())
> +        DI->setLocation(FD->getLocation());
> +
> +      DI->EmitFunctionStart(FD, CurFn, Builder);
> +  }
> +
>    // Emit allocs for param decls.  Give the LLVM Argument nodes 
> names.
>    llvm::Function::arg_iterator AI = CurFn->arg_begin();
>
> @@ -215,6 +224,14 @@
>    // Emit the function body.
>    EmitStmt(FD->getBody());
>
> +  if (DI) {
> +    CompoundStmt *CS = dyn_cast<CompoundStmt>(FD->getBody());
> +    if (CS && CS->getRBracLoc().isValid())
> +      DI->setLocation (CS->getRBracLoc());
> +
> +    DI->EmitRegionEnd(CurFn, Builder);
> +  }
> +

Pl. duplicate this in GenerateObjcMethod also.  As FIXME says, 
eventually we want to factor common code between this two fns.

Pl. take care of free TypeCache FIXME sooner.
Otherwise the patch looks ok.
Thanks!
-
Devang


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080516/224aad68/attachment.html>


More information about the cfe-commits mailing list