[cfe-dev] Inheritance Information in Debug Information

Jon Eyolfson via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 23 11:53:08 PST 2017


Hello, I'm trying to understand why I'm not getting all the inheritance
information for the following example:

    class TwoVirtual {
    public:
      virtual void foo();
      virtual void bar() const;
    };
    
    class TwoImpl : public TwoVirtual {
      TwoImpl() {}
    public:
      virtual void foo() {}
      virtual void bar() const {}
    };
    
    class NoSubOrSuper {
      TwoImpl t;
      void baz() {}
    };
    
    class OneSuper : public TwoImpl {
      void baz() {}
    };

I'm generating llvm code with the following command:

    clang++ -std=c++14 -g -O1 -Xclang -disable-llvm-optzns -emit-llvm
            -femit-all-decls -S -c TestFile.cpp -o TestFile.ll

I'm using -O1 because I need TBAA information present.

What I get is only one DIDerivedType with the DW_TAG_inheritance tag.
This connects TwoImpl to TwoVirtual. However there isnt an inheritance
tag between OneSuper and TwoImpl. Is there a reason for this? I'm trying
to determine in the llvm code that NoSubOrSuper and OneSuper are different
(on has an inheritance relation and the other doesn't). Thanks!



More information about the cfe-dev mailing list