[llvm] r181835 - Make getCompileUnit non-const and return the current DIE if it

David Blaikie dblaikie at gmail.com
Tue May 14 14:55:30 PDT 2013


On Tue, May 14, 2013 at 2:33 PM, Eric Christopher <echristo at gmail.com>wrote:

> Author: echristo
> Date: Tue May 14 16:33:10 2013
> New Revision: 181835
>
> URL: http://llvm.org/viewvc/llvm-project?rev=181835&view=rev
> Log:
> Make getCompileUnit non-const and return the current DIE if it
> happens to be a compile unit. Noticed on inspection and tested
> via calling on a newly created compile unit. No functional change.
>

Any idea if this is a necessary/reachable codepath? (seems subtle enough
that it'd be nice to have an actual example of that)
Otherwise perhaps it'd be sufficient to just assert that you don't ask a
CompileUnit for its CompileUnit?


>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=181835&r1=181834&r2=181835&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Tue May 14 16:33:10 2013
> @@ -114,8 +114,8 @@ DIE::~DIE() {
>
>  /// Climb up the parent chain to get the compile unit DIE to which this
> DIE
>  /// belongs.
> -DIE *DIE::getCompileUnit() const {
> -  DIE *p = getParent();
> +DIE *DIE::getCompileUnit() {
> +  DIE *p = this;
>    while (p) {
>      if (p->getTag() == dwarf::DW_TAG_compile_unit)
>        return p;
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=181835&r1=181834&r2=181835&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Tue May 14 16:33:10 2013
> @@ -153,7 +153,7 @@ namespace llvm {
>      DIE *getParent() const { return Parent; }
>      /// Climb up the parent chain to get the compile unit DIE this DIE
> belongs
>      /// to.
> -    DIE *getCompileUnit() const;
> +    DIE *getCompileUnit();
>      void setTag(unsigned Tag) { Abbrev.setTag(Tag); }
>      void setOffset(unsigned O) { Offset = O; }
>      void setSize(unsigned S) { Size = S; }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130514/fec86b4a/attachment.html>


More information about the llvm-commits mailing list