From 64361e3c8b623f64233e0c6192e6b7167121ae68 Mon Sep 17 00:00:00 2001
From: Alexander Kornienko
When editing C++ code, hit F5 to reparse the current buffer. The output will
go into the error window, which you can enable with :cope
.
Other clang-check
options that can be useful when working with
+clang AST:
-ast-print
- Build ASTs and then pretty-print them.-ast-dump
- Build ASTs and then debug dump them.-ast-dump-filter=<string>
- Use with
+ -ast-dump
or -ast-print
to dump/print
+ only AST declaration nodes having a certain substring in a qualified name.
+ Use -ast-list
to list all filterable declaration node
+ names.-ast-list
- Build ASTs and print the list of declaration
+ node qualified names.Examples:
++$ clang-check tools/clang/tools/clang-check/ClangCheck.cpp -ast-dump -ast-dump-filter ActionFactory::newASTConsumer +Processing: tools/clang/tools/clang-check/ClangCheck.cpp. +Dumping::ActionFactory::newASTConsumer: +clang::ASTConsumer *newASTConsumer() (CompoundStmt 0x44da290 </home/alexfh/local/llvm/tools/clang/tools/clang-check/ClangCheck.cpp:64:40, line:72:3> + (IfStmt 0x44d97c8 <line:65:5, line:66:45> + <<<NULL>>> + (ImplicitCastExpr 0x44d96d0 <line:65:9> '_Bool':'_Bool' <UserDefinedConversion> +... +$ clang-check tools/clang/tools/clang-check/ClangCheck.cpp -ast-print -ast-dump-filter ActionFactory::newASTConsumer +Processing: tools/clang/tools/clang-check/ClangCheck.cpp. +Printing <anonymous namespace>::ActionFactory::newASTConsumer: +clang::ASTConsumer *newASTConsumer() { + if (this->ASTList.operator _Bool()) + return clang::CreateASTDeclNodeLister(); + if (this->ASTDump.operator _Bool()) + return clang::CreateASTDumper(this->ASTDumpFilter); + if (this->ASTPrint.operator _Bool()) + return clang::CreateASTPrinter(&llvm::outs(), this->ASTDumpFilter); + return new clang::ASTConsumer(); +} +