1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <META http-equiv=
"Content-Type" content=
"text/html; charset=ISO-8859-1" />
6 <title>Clang - Quick Tutorial
</title>
7 <link type=
"text/css" rel=
"stylesheet" href=
"menu.css" />
8 <link type=
"text/css" rel=
"stylesheet" href=
"content.css" />
12 <!--#include virtual="menu.html.incl"-->
18 <p>Invoking the BoostCon tool:
</p>
20 $ clang -cc1 -boostcon t.cpp
23 <p>Teach the BoostCon action to identify and print C++ classes:
</p>
25 bool VisitCXXRecordDecl(CXXRecordDecl *D) {
26 std::cout
<< D-
>getNameAsString()
32 <p>Walk and print base classes of a class:
</p>
34 for(CXXRecordDecl::base_class_iterator
35 B = D-
>bases_begin(), BEnd = D-
>bases_end();
37 QualType BaseType = B-
>getType();
38 std::cout
<< " " << BaseType.getAsString()
43 <p>Retrieve the C++ class declaration from a base type:
</p>
45 if (const RecordType *RTy
46 = BaseType-
>getAs
<RecordType
>()) {
47 RecordDecl *Base = RTy-
>getDecl();
48 if (CXXRecordDecl *BaseCXX
49 = dyn_cast
<CXXRecordDecl
>(Base)) {