[llvm-commits] [llvm] r117577 - /llvm/trunk/include/llvm/Analysis/DebugInfo.h

Chris Lattner clattner at apple.com
Thu Oct 28 16:55:29 PDT 2010


On Oct 28, 2010, at 12:14 PM, Devang Patel wrote:

> Author: dpatel
> Date: Thu Oct 28 14:14:28 2010
> New Revision: 117577
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=117577&view=rev
> Log:
> Do not rely on context to find file info. It is already provided as a separate field.

This has funky indentation, please use 2 spaces consistently.  Also, just:

  return getFieldAs<DIFile>(3).getDirectory();

should be enough, no need to split across two lines.

-Chris

> 
> Modified:
>    llvm/trunk/include/llvm/Analysis/DebugInfo.h
> 
> Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=117577&r1=117576&r2=117577&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Oct 28 14:14:28 2010
> @@ -582,8 +582,14 @@
>     explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
>     DIScope getContext() const     { return getFieldAs<DIScope>(1);      }
>     StringRef getName() const      { return getStringField(2);           }
> -    StringRef getDirectory() const { return getContext().getDirectory(); }
> -    StringRef getFilename() const  { return getContext().getFilename();  }
> +    StringRef getDirectory() const  { 
> +        DIFile F = getFieldAs<DIFile>(3);
> +        return F.getDirectory();
> +    }
> +    StringRef getFilename() const  { 
> +        DIFile F = getFieldAs<DIFile>(3);
> +        return F.getFilename();
> +    }
>     DICompileUnit getCompileUnit() const{ 
>       if (getVersion() == llvm::LLVMDebugVersion7)
>         return getFieldAs<DICompileUnit>(3);
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list