<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<title>Some basic AST file generation questions</title>
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Arial",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">For (1) on my Linux<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">clang -cc1 -help<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">shows options of the compiler proper including ast-dump but I didn’t get syntax-only.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Nigel<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> cfe-users <cfe-users-bounces@lists.llvm.org>
<b>On Behalf Of </b>Ray Mitchell via cfe-users<br>
<b>Sent:</b> 26 March 2021 00:25<br>
<b>To:</b> cfe-users@lists.llvm.org<br>
<b>Subject:</b> [cfe-users] Some basic AST file generation questions<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Win10-64, clang v11.0.0, VS2019<br>
<br>
When I enter "clang.exe -help" from the command line I get a long list of clang options, and one of them is "-Xclang <arg>". Thanks to previous help from a member of the cfe-users digest, I am able to do "clang.exe -Xclang -ast-dump -fsyntax-only SourceFile.c"
to get the AST file for my source file. I have some basic questions about all this:<br>
<br>
1. I may have asked this before, but I've forgotten :-( The -ast-dump and -fsyntax-only options above are not listed when I enter "clang.exe -help". Is there a command line option that will list these and all other options that are missing from the basic
-help list? If so, what is it? If not, specifically where can I find these additional options listed and described?<br>
<br>
2. All of the following code I describe compiles, links, and runs correctly: I have an include guard protected header file named MyClass.h that includes a couple standard library headers followed by the declaration of a const variable followed by the definition
of C++ class named MyClass followed by the definition of an inline function. When I do "clang.exe -Xclang -ast-dump -fsyntax-only MyClass.h" the resulting AST file contains the typical AST information from the two included header files, but only contains
the two following lines for my code:<br>
|-VarDecl 0xb1ba010 <C:\MyClass.h:23:1, col:7> col:7 invalid MyClass 'int'<br>
`-VarDecl 0xb1ba060 <line:41:1, col:13> col:13 invalid MyClass 'void'<br>
When I look at the AST files produced for any of my implementation files that contain #include "MyClass.h", the complete AST information for MyClass.h is there. Why is most of that AST information missing from the AST file produced directly from MyClass.h
and how can I cause it to be there?<br>
<br>
Thank you :-)<br>
Ray<o:p></o:p></p>
</div>
</body>
</html>