diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-11 22:09:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-11 22:09:20 +0000 |
commit | c022914620ecbc68913bfaaff76b00d17d07f53e (patch) | |
tree | 72c618167afa6139d787b89277c5fa1848fe915a /clang/www/clang-tutorial.html | |
parent | afd2b8bbb7ed3221adfffc259d24bca3499ab432 (diff) | |
download | bcm5719-llvm-c022914620ecbc68913bfaaff76b00d17d07f53e.tar.gz bcm5719-llvm-c022914620ecbc68913bfaaff76b00d17d07f53e.zip |
BoostCon tutorial notes, temporary
llvm-svn: 103520
Diffstat (limited to 'clang/www/clang-tutorial.html')
-rw-r--r-- | clang/www/clang-tutorial.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/clang/www/clang-tutorial.html b/clang/www/clang-tutorial.html new file mode 100644 index 00000000000..0e17046996e --- /dev/null +++ b/clang/www/clang-tutorial.html @@ -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> |