Decl::dump() doesn't print/visit(?) some statements (such as: bool x = true)

Hi all,

I have MyConsumer class which implemented ASTConsumer and inherited from
RecursiveASTVisitor to instrument some code at some point in a program. I
have noticed that some statements are not visited.

So I use Decl::dump() in TraverseDecl(Decl *D) to see all declaration detail
especially function declaration.

My test program look like this : (I omit the main function here)

void bubble_sort(int* array, int size) {
   bool continue_flag = true;
   do {
    continue_flag = false;
    for (int i = 0; i < size - 1; i++) {
      if (array[i] > array [i+1]){
                 int temp = array[i] ;
           array[i] = array[i+1] ;
           array[i+1] = temp;
           continue_flag = true;
  } while (continue_flag);

What I got from Decl::dump() is

void bubble_sort(int *array, int size) {


But when I changed the type from bool to int, Decl::dump() printed all
My test program is compiled just fine using g++.

What does that mean? Clang doesn't know bool keyword (very unlikely)?
It also ignore statements like printf, cout too.

Here is my command to build the executable:

++ inst.cpp -g -o tc `$LLVM/Release+Profile+Asserts/bin/llvm-config
--cxxflags` -I$LLVM/tools/clang/include/ -lclangFrontendTool -lclangFrontend
-lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema
-lclangAnalysis -lclangIndex -lclangRewrite -lclangAST -lclangLex
-lclangBasic `$LLVM/Release+Profile+Asserts/bin/llvm-config --ldflags
--libs` -I/usr/local/include -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS

Do I miss something?


I did -ast-print and everything shows up in the AST

I really have no idea how to deal with this :confused:

dump() is a debugging aid that is known to be incomplete and incorrect. It gets improved as needed, and patches are always welcome.

  - Doug

I see, thank you very much