A bug in CXXCtorInitializer?


I don’t know if this is a bug, but I have the following initializer in an initialization list:

: KTextEditor::Cursor(c)

This is the AST for that initializer:

-CXXCtorInitializer ‘KTextEditor::Cursor’:‘class KTextEditor::Cursor’

-CXXConstructExpr 0x34f5ef8 <line:877:20, col:28> ‘KTextEditor::Cursor’:‘class KTextEditor::Cursor’ ‘void (const class KTextEditor::Cursor &)’
`-DeclRefExpr 0x34f5e78 col:27 ‘const KTextEditor::Cursor’:‘const class KTextEditor::Cursor’ lvalue ParmVar 0x34f1c80 ‘c’ ‘const KTextEditor::Cursor &’

I am trying to delete the initializer completely. To that end, I use “CXXConstructorDecl::init_const_iterator” to iterate over the initializers of the constructor and then I invoke “getSourceRange()” when I locate this initializer. In the documentation of this method in “CXXCtorInitializer” says: “Determine the source range covering the entire initializer.”. However, when removing the text in this range, I obtain:

: KTextEditor::

That is, the qualifier is not considered as part of the range of the initializer. Is this a bug or am I overlooking something? (I’m using the verison 3.4)