title: Windows Clang Ast Dump
body: <p>I am working on a Windows 10 server, and I have clang 7.0.0 install on (from <a href="http://prereleases.llvm.org/7.0.0/" rel="nofollow noreferrer">llvm</a>), and I'm attempting to get the abstract syntax trees (ast) of several programs that use templates in c++, however, I don't seem to be able to get the full ast. The command below is what I use on both my windows server and on my personal laptop which is running linux and has clang 7.0.0.</p>
  
  <pre><code>clang++ -c -fno-color-diagnostics -Xclang -ast-dump input.cpp &gt; output.txt
  </code></pre>
  
  <p>The file, "input.cpp", is a simple mock template class:</p>
  
  <pre><code>template &lt;class T&gt;
  class Thing {
  private:
       T a_ {};
  public:
       Thing() = default;
       void set_thing(T a) { a_ = a; }
       T&amp; get_thing() { return a_; }
  };
  </code></pre>
  
  <p>On my windows server, the output of template class is seen below:</p>
  
  <pre><code>`-ClassTemplateDecl 0x21dcd03f4c8 &lt;input.cpp:1:1, line:12:1&gt; line:2:7 Thing
    |-TemplateTypeParmDecl 0x21dcd03f378 &lt;line:1:11, col:17&gt; col:17 referenced class depth 0 index 0 T
    `-CXXRecordDecl 0x21dcd03f430 &lt;line:2:1, line:12:1&gt; line:2:7 class Thing definition
      |-DefinitionData standard_layout trivially_copyable has_user_declared_ctor can_const_default_init
      | |-DefaultConstructor exists
      | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
      | |-MoveConstructor exists simple trivial needs_implicit
      | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
      | |-MoveAssignment exists simple trivial needs_implicit
      | `-Destructor simple irrelevant trivial needs_implicit
      |-CXXRecordDecl 0x21dcd03f730 &lt;col:1, col:7&gt; col:7 implicit referenced class Thing
      |-AccessSpecDecl 0x21dcd03f7c8 &lt;line:4:1, col:8&gt; col:1 private
      |-FieldDecl 0x21dcd03f800 &lt;line:5:2, col:8&gt; col:4 a_ 'T'
      | `-InitListExpr 0x21dcd03fd30 &lt;col:7, col:8&gt; 'void'
      |-AccessSpecDecl 0x21dcd03f850 &lt;line:6:1, col:7&gt; col:1 public
      |-CXXConstructorDecl 0x21dcd03f920 &lt;line:7:2, col:18&gt; col:2 Thing&lt;T&gt; 'void ()' default
      |-CXXMethodDecl 0x21dcd03fae0 &lt;line:8:2, col:20&gt; col:7 set_thing 'void (T)'
      | |-ParmVarDecl 0x21dcd03f9e0 &lt;col:17, col:19&gt; col:19 a 'T'
      | `-&lt;&lt;&lt;NULL&gt;&gt;&gt;
      `-CXXMethodDecl 0x21dcd03fc70 &lt;line:11:2, col:15&gt; col:5 get_thing 'T &amp;()'
        `-&lt;&lt;&lt;NULL&gt;&gt;&gt;
  </code></pre>
  
  <p>On my personal laptop, the output is shown below:</p>
  
  <pre><code>`-ClassTemplateDecl 0x64dfc38 &lt;input.cpp:1:1, line:12:1&gt; line:2:7 Thing
    |-TemplateTypeParmDecl 0x64dfae8 &lt;line:1:11, col:17&gt; col:17 referenced class depth 0 index 0 T
    `-CXXRecordDecl 0x64dfba0 &lt;line:2:1, line:12:1&gt; line:2:7 class Thing definition
      |-DefinitionData standard_layout trivially_copyable has_user_declared_ctor can_const_default_init
      | |-DefaultConstructor exists
      | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
      | |-MoveConstructor exists simple trivial needs_implicit
      | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
      | |-MoveAssignment exists simple trivial needs_implicit
      | `-Destructor simple irrelevant trivial needs_implicit
      |-CXXRecordDecl 0x64dfea0 &lt;col:1, col:7&gt; col:7 implicit referenced class Thing
      |-AccessSpecDecl 0x64dff38 &lt;line:4:1, col:8&gt; col:1 private
      |-FieldDecl 0x64dff70 &lt;line:5:2, col:8&gt; col:4 referenced a_ 'T'
      | `-InitListExpr 0x64e0490 &lt;col:7, col:8&gt; 'void'
      |-AccessSpecDecl 0x64dffb8 &lt;line:6:1, col:7&gt; col:1 public
      |-CXXConstructorDecl 0x64e0080 &lt;line:7:2, col:18&gt; col:2 Thing&lt;T&gt; 'void ()' default
      |-CXXMethodDecl 0x64e0240 &lt;line:8:2, line:10:2&gt; line:8:7 set_thing 'void (T)'
      | |-ParmVarDecl 0x64e0140 &lt;col:17, col:19&gt; col:19 referenced a 'T'
      | `-CompoundStmt 0x64e0570 &lt;col:22, line:10:2&gt;
      |   `-BinaryOperator 0x64e0548 &lt;line:9:3, col:8&gt; '&lt;dependent type&gt;' '='
      |     |-MemberExpr 0x64e04e8 &lt;col:3&gt; 'T' lvalue -&gt;a_ 0x64dff70
      |     | `-CXXThisExpr 0x64e04d0 &lt;col:3&gt; 'Thing&lt;T&gt; *' this
      |     `-DeclRefExpr 0x64e0520 &lt;col:8&gt; 'T' lvalue ParmVar 0x64e0140 'a' 'T'
      `-CXXMethodDecl 0x64e03d0 &lt;line:11:2, col:30&gt; col:5 get_thing 'T &amp;()'
        `-CompoundStmt 0x64e05f0 &lt;col:17, col:30&gt;
          `-ReturnStmt 0x64e05d8 &lt;col:19, col:26&gt;
            `-MemberExpr 0x64e05a0 &lt;col:26&gt; 'T' lvalue -&gt;a_ 0x64dff70
              `-CXXThisExpr 0x64e0588 &lt;col:26&gt; 'Thing&lt;T&gt; *' this
  </code></pre>
  
  <p>My focus is on the "NULL" nodes of the tree when I run the command on windows, and is not seen on my laptop. I was wondering what actions I could take to get the latter output on windows. I've attempted other versions like clang 6.0.0 with no luck. I have also attempt to use the command clang++ -cc1 -ast-dump input.cpp, however, it has problems with includes as cited <a href="https://stackoverflow.com/questions/18560019/how-to-view-clang-ast">here</a>. </p>
  
  <p>Note: I use html code snippet to format the ast tree because it was able to format it the best.  </p>