unknown type name 'ObjCClassDecl'

Hi,

I'm new to Clang so please forgive me for the stupid questions.

I'm in the middle of compiling a project that used clang as a library. I'm
using Clang3.2 The problem is when I tried to compile the project, there is
some missing declarations, such as
ObjCClassDecl
ObjCForwardProtocolDecl
Dump in clang::PrintingPolicy
...
I found that these definitions are not in the most recent version of clang
(clang3.4), too.

I wonder these definitions are from older version of clangs? (e.g.,
clang3.1). If the project is using those things, is there workaround?

By the way, is it safe to state that "there is a full C++ parse in Clang"?

Thanks

Hi,

I'm new to Clang so please forgive me for the stupid questions.

I'm in the middle of compiling a project that used clang as a library. I'm
using Clang3.2 The problem is when I tried to compile the project, there is
some missing declarations, such as
ObjCClassDecl
ObjCForwardProtocolDecl
Dump in clang::PrintingPolicy
...
I found that these definitions are not in the most recent version of clang
(clang3.4), too.

I wonder these definitions are from older version of clangs? (e.g.,
clang3.1). If the project is using those things, is there workaround?

Probably from an older version, yes. Your choices are to either use an
older version of clang or update your project for the API changes. It
might be helpful to search the cfe-commits archives for various symbols.

By the way, is it safe to state that "there is a full C++ parse in Clang"?

Yes.

-Eli

Hi, thank for replying. I got it now.

May I have another question? Where do I get documentation about the AST
structure of produced from clang? The reason why I ask this because I don't
find the information in "clang internal" section in the homepage of clang is
enough to fully understand about the AST structure. For example, when using
the clang::RecursiveASTVisitor to traverse the tree, I don't know which
function (VisitSomething) I have to rewrite to print out the node's
information.

My ultimate goal is to construct a source-to-source transformation. I need
to start from parsing a source code and regenerate the code but to do that I
need to understand the AST first. Any suggestions on how I should start
would be great.

Hi, thank for replying. I got it now.

May I have another question? Where do I get documentation about the AST
structure of produced from clang? The reason why I ask this because I don't
find the information in "clang internal" section in the homepage of clang
is
enough to fully understand about the AST structure. For example, when using
the clang::RecursiveASTVisitor to traverse the tree, I don't know which
function (VisitSomething) I have to rewrite to print out the node's
information.

Try http://clang.llvm.org/doxygen/ . Also, looking at small examples using
the -ast-dump flag can be helpful.

My ultimate goal is to construct a source-to-source transformation. I need
to start from parsing a source code and regenerate the code but to do that
I
need to understand the AST first. Any suggestions on how I should start
would be great.

I haven't really done much of that sort of thing; hopefully someone else
will chime in.

There are some examples of using clang's rewriter infrastructure in
clang/lib/Rewrite/Frontend/ in the source tree, if that's what you're
looking for. See also http://clang.llvm.org/docs/Tooling.html and
http://clang.llvm.org/docs/ExternalClangExamples.html .

-Eli

The talk "The Clang AST - a tutorial" by Manuel Klimek might be
interesting for you. You can find it here:
http://llvm.org/devmtg/2013-04/

Dmitri

It's also here: <http://clang.llvm.org/docs/IntroductionToTheClangAST.html>

-- Sean Silva

Thanks for the information. Somehow I have read most of the articles you gave
except the talks. I think there is documents can clearly answer something
like "which function is called (or which node is visited) after visiting the
root". Rather the best way is probably reading the codes (from samples and
from real project somewhere).

I would love if I still get more from this thread.

Thanks all.