[cfe-commits] r103520 - /cfe/trunk/www/clang-tutorial.html
Douglas Gregor
dgregor at apple.com
Tue May 11 15:09:20 PDT 2010
Author: dgregor
Date: Tue May 11 17:09:20 2010
New Revision: 103520
URL: http://llvm.org/viewvc/llvm-project?rev=103520&view=rev
Log:
BoostCon tutorial notes, temporary
Added:
cfe/trunk/www/clang-tutorial.html (with props)
Added: cfe/trunk/www/clang-tutorial.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/clang-tutorial.html?rev=103520&view=auto
==============================================================================
--- cfe/trunk/www/clang-tutorial.html (added)
+++ cfe/trunk/www/clang-tutorial.html Tue May 11 17:09:20 2010
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+ <title>Clang - Quick Tutorial</title>
+ <link type="text/css" rel="stylesheet" href="menu.css" />
+ <link type="text/css" rel="stylesheet" href="content.css" />
+</head>
+<body>
+
+<!--#include virtual="menu.html.incl"-->
+
+<div id="content">
+
+<h1>Tutorial</h1>
+
+ <p>Invoking the BoostCon tool:</p>
+ <pre>
+$ clang -cc1 -boostcon t.cpp
+</pre>
+
+ <p>Teach the BoostCon action to identify and print C++ classes:</p>
+ <pre>
+bool VisitCXXRecordDecl(CXXRecordDecl *D) {
+ std::cout << D->getNameAsString()
+ << '\n';
+ return false;
+}
+</pre>
+
+ <p>Walk and print base classes of a class:</p>
+ <pre>
+for(CXXRecordDecl::base_class_iterator
+ B = D->bases_begin(), BEnd = D->bases_end();
+ B != BEnd; ++B) {
+ QualType BaseType = B->getType();
+ std::cout << " " << BaseType.getAsString()
+ << '\n';
+}
+</pre>
+
+ <p>Retrieve the C++ class declaration from a base type:</p>
+ <pre>
+if (const RecordType *RTy
+ = BaseType->getAs<RecordType>()) {
+ RecordDecl *Base = RTy->getDecl();
+ if (CXXRecordDecl *BaseCXX
+ = dyn_cast<CXXRecordDecl>(Base)) {
+
+ }
+}
+</pre>
+</div>
+</body>
+</html>
Propchange: cfe/trunk/www/clang-tutorial.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/www/clang-tutorial.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/www/clang-tutorial.html
------------------------------------------------------------------------------
svn:mime-type = text/html
More information about the cfe-commits
mailing list