[cfe-commits] PATCH : Function Start Debug Info

Devang Patel dpatel at apple.com
Fri May 16 09:05:23 PDT 2008


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



More information about the cfe-commits mailing list