[cfe-users] Some basic AST file generation questions
Nigel Perks via cfe-users
cfe-users at lists.llvm.org
Fri Mar 26 04:54:52 PDT 2021
For (1) on my Linux
clang -cc1 -help
shows options of the compiler proper including ast-dump but I didn't get syntax-only.
Nigel
From: cfe-users <cfe-users-bounces at lists.llvm.org> On Behalf Of Ray Mitchell via cfe-users
Sent: 26 March 2021 00:25
To: cfe-users at lists.llvm.org
Subject: [cfe-users] Some basic AST file generation questions
Win10-64, clang v11.0.0, VS2019
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:
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?
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:
|-VarDecl 0xb1ba010 <C:\MyClass.h:23:1, col:7> col:7 invalid MyClass 'int'
`-VarDecl 0xb1ba060 <line:41:1, col:13> col:13 invalid MyClass 'void'
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?
Thank you :-)
Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20210326/b025c486/attachment.html>
More information about the cfe-users
mailing list