srcML v1.0.0 C++ Documentation

Base Elements XML Element Subelements
comment <comment type="line|block">
<comment type="line" format="doxygen">
<comment type="block" format="doxygen">
literal <literal type="boolean|char|complex|null|number|string">
escape <escape char="0xXX">
name <name>
Statements XML Element Subelements
block <block> <block_content>
break statement <break>
case statement <case> <expr>
continue statement <continue>
default statement <default>
do while statement <do> <block>,<condition>
empty statement <empty_stmt>
expression statement <expr_stmt> <expr>
for statement <for> <control>,<block>
goto statement <goto> <name>
if statement <if_stmt> <if>,<if type="elseif">,<else>
label statement <label> <name>
pseudo block <block type="pseudo"> <block_content>
return statement <return> <expr>
switch statement <switch> <condition>,<block>,<case>,<default>
while statement <while> <condition>,<block>
Statement Subelements XML Element Subelements
block content <block_content>
capture <capture> <argument>
condition <condition> <expr>
control <control> <init>,<condition>,<incr>
else <else> <block>
else if <if type="elseif"> <condition>,<block>
expression <expr> <name>,<operator>,<call>,<ternary>
if <if> <condition>,<block>
incr <incr> <expr>
then <then> <expr>
type <type> <specifier>,<name>
Specifiers XML Element Subelements
auto specifier <specifier>auto</specifier>
auto type <name>auto</name>
const <specifier>const</specifier>
constexpr <specifier>constexpr</specifier>
default specifier <specifier>default</specifier>
delete specifier <specifier>delete</specifier>
explicit <specifier>explicit</specifier>
extern block <extern> <literal type="string">,<function_decl>,<decl_stmt>,<block>
extern specifier <specifier>extern</specifier>
final <specifier>final</specifier>
friend <friend>
inline <specifier>inline</specifier>
mutable <specifier>mutable</specifier>
override <specifier>override</specifier>
r-value reference <ref_qualifier>
register <specifier>register</specifier>
restrict <specifier>restrict</specifier>
static <specifier>static</specifier>
template specifier <specifier>template</specifier>
thread_local <specifier>thread_local</specifier>
virtual <specifier>virtual</specifier>
volatile <specifier>volatile</specifier>
Declarations, Definitions, and Initializations XML Element Subelements
bitfield <range> <expr>
declaration initialization <init>
function <function> <type>,<name>,<parameter_list>,<block>
function declaration <function_decl> <type>,<name>,<parameter_list>
lambda functions <lambda> <capture>,<parameter_list>,<type>,<block>
namespace <namespace> <name>,<block>
operator declaration <function_decl type="operator"> <type>,<name>,<parameter_list>
operator definition <function type="operator"> <type>,<name>,<parameter_list>,<block>
pointer declaration <modifier>*</modifier>
reference declaration <modifier>amp;</modifier>
rvalue reference <modifier>amp;amp;</modifier>
typedef <typedef> <type>,<name>,<function_decl>
using <using> <name>
variable declaration <decl> <name>,<init>,<index>,<block>
variable declaration statement <decl_stmt> <decl>
Classes, Structs, Unions, and Enums XML Element Subelements
class declaration <class_decl> <name>
class definition <class> <name>,<super_list>,<super>,<block>
constructor <constructor> <name>,<parameter_list>,<specifier>,<member_init_list>,<block>
constructor declaration <constructor_decl> <specifier>,<name>,<parameter_list>
destructor <destructor> <specifier>,<name>,<parameter_list>,<block>
destructor declaration <destructor_decl> <name>
enum class <enum type="class">
enum class declaration <enum_decl type="class">
enum declaration <enum_decl> <name>
enum definition <enum> <name>,<block>
inheritance list <super_list> <super>
private access specifier <private>
private default access specifier <private type="default">
private inheritance specifier <specifier>private</specifier>
protected access specifier <protected>
protected inheritance specifier <specifier>protected</specifier>
public access specifier <public>
public default access specifier <public type="default">
public inheritance specifier <specifier>public</specifier>
struct declaration <struct_decl> <name>
struct definition <struct> <name>,<super_list>,<block>
union declaration <union_decl> <name>
union definition <union> <name>,<block>
Expressions XML Element Subelements
delete operator <operator>delete</operator>
function call <call> <name>,<argument_list>
new operator <operator>new</operator>
operator <operator>
ternary operator <ternary> <condition>,<then>,<else>
this <name>this</name>
Other XML Element Subelements
alignas <alignas> <argument_list>
alignof <alignof> <argument_list>
asm <asm>
attribute <attribute> <expr>
const cast <cast type="const"> <argument_list>
decltype <decltype> <argument_list>
dynamic cast <cast type="dynamic"> <argument_list>
noexcept <noexcept> <argument_list>
reinterpret cast <cast type="reinterpret"> <argument_list>
sizeof <sizeof> <argument_list>
sizeof... <sizeof type="pack"> <argument_list>,<name>
static cast <cast type="static"> <argument_list>
static_assert <assert type="static"> <argument_list>
typeid <typeid> <argument_list>
Templates XML Element Subelements
class type specifier <type>class</type>
template <template> <parameter_list>,<parameter>,<type>
template parameter pack <modifier>...</modifier>
template parameters <parameter_list> <parameter>
typename <typename>
Exceptions XML Element Subelements
catch <catch> <parameter_list>
throw <throw> <expr>
try <try> <block>,<catch>,<member_init_list>
OpenMP XML Element Subelements
omp:argument <omp:argument> <omp:expr>
omp:argument_list <omp:argument_list> <omp:argument>
omp:clause <omp:clause> <omp:name>,<omp:argument_list>
omp:directive <omp:directive> <omp:name>,<omp:clause>
omp:expr <omp:expr>
omp:name <omp:name>
C Preprocessor XML Element Subelements
# <cpp:empty>
#define <cpp:define> <cpp:directive>,<cpp:macro>,<cpp:value>
#elif <cpp:elif> <cpp:directive>,<expr>
#else <cpp:else> <cpp:directive>
#endif <cpp:endif> <cpp:directive>
#error <cpp:error> <cpp:directive>,<cpp:literal>
#if <cpp:if> <cpp:directive>,<expr>
#ifdef <cpp:ifdef> <cpp:directive>,<name>
#ifndef <cpp:ifndef> <cpp:directive>,<name>
#include <cpp:include> <cpp:directive>,<cpp:file>
#line <cpp:line> <cpp:directive>,<cpp:number>,<cpp:file>
#pragma <cpp:pragma> <cpp:directive>,<name>
#undef <cpp:undef> <cpp:directive>,<name>
#warning <cpp:warning> <cpp:directive>,<cpp:literal>
cpp:directive <cpp:directive>
cpp:file <cpp:file>
cpp:literal <cpp:literal>
cpp:macro <cpp:macro> <name>
cpp:number <cpp:number>
cpp:value <cpp:value>

line comment


Element

  • <comment type="line">

XPath Queries

  • comments

    //src:comment
  • line comments

    //src:comment[@type='line']

Example

// line
<comment type="line">// line</comment>

block comment


Element

  • <comment type="block">

XPath Queries

  • comments

    //src:comment
  • block comments

    //src:comment[@type='block']

Example

/*
    block
*/
<comment type="block">/*
    block
*/</comment>

doxygen line comment


Element

  • <comment type="line" format="doxygen">

XPath Queries

  • comments

    //src:comment
  • doxygen comments

    //src:comment[@format='doxygen']

doxygen block comment


Element

  • <comment type="block" format="doxygen">

XPath Queries

  • comments

    //src:comment
  • doxygen comments

    //src:comment[@format='doxygen']

Example

/**
 * doxygen comment
 */
/*!
 * text
 */
<comment type="block" format="doxygen">/**
 * doxygen comment
 */</comment>
<comment type="block" format="doxygen">/*!
 * text
 */</comment>

number literal


Element

  • <literal type="number">

XPath Queries

  • number literals

    //src:literal[@type='number']
  • abstract function declarations

    //src:function_decl[src:literal=0]

character literal


Element

  • <literal type="char">

XPath Query

  • character literals

    //src:literal[@type='char']

string literal


Element

  • <literal type="string">

XPath Query

  • string literals

    //src:literal[@type='string']

boolean literal


Element

  • <literal type="boolean">

XPath Query

  • boolean literals

    //src:literal[@type='boolean']

null literal


Element

  • <literal type="null">

XPath Query

  • null literals

    //src:literal[@type='null']

complex literal


Element

  • <literal type="complex">

XPath Query

  • complex literals

    //src:literal[@type='complex']

if statement


Element

  • <if_stmt>

Subelements

  • <if>
  • <if type="elseif">
  • <else>

XPath Queries

  • if conditions

    //src:if/src:condition
  • then

    //src:if/src:block
  • else

    //src:else/src:block
  • if statements without an else

    //src:if_stmt[not(src:else)]
  • else if

    //src:if[@type='elseif']
  • First if in a nested if statement

    //src:if_stmt/src:if[1]
  • Second if in a nested if statement

    //src:if_stmt/src:if[2]
  • Last if in a nested if statement

    //src:if_stmt/src:if[last()]

Examples

if then

if (A)
    B;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if></if_stmt>

if then else

if (A)
    B;
else
    C;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

if then elseif

if (A)
    B;
else if (A2)
    C;
else
    D:
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<if type="elseif">else if <condition>(<expr><name>A2</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <label><name>D</name>:</label></block_content></block></else></if_stmt>
if(x > 5)
    y+=4;
<if_stmt><if>if<condition>(<expr><name>x</name> <operator>&gt;</operator> <literal type="number">5</literal></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name><operator>+=</operator><literal type="number">4</literal></expr>;</expr_stmt></block_content></block></if></if_stmt>
if ( i > 0 ) {
    y = x / i;
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt>
</block_content>}</block></if></if_stmt>
if ( i > 0 )
    y = x / i;
else {
    x = i;
    y = f( x );
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt></block_content></block></if>
<else>else <block>{<block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <call><name>f</name><argument_list>( <argument><expr><name>x</name></expr></argument> )</argument_list></call></expr>;</expr_stmt>
</block_content>}</block></else></if_stmt>

Without braces

if ( i > 0 )
    if ( j > i )
        x = j;
    else
        x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if>
    <else>else<block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt></block_content></block></if></if_stmt>

With braces

if ( i > 0 ) {
    if ( j > i )
        x = j;
}
else
    x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if></if_stmt>
</block_content>}</block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt>
if ( i > 0 ) {
 	x = i;
}
else if( i < 0)
	x = q;
else
    x = j;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
 	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>
</block_content>}</block></if>
<if type="elseif">else if<condition>( <expr><name>i</name> <operator>&lt;</operator> <literal type="number">0</literal></expr>)</condition><block type="pseudo"><block_content>
	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>q</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

while statement


Element

  • <while>

Subelements

  • <condition>
  • <block>

XPath Queries

  • while loops

    //src:while
  • while-loop conditions

    //src:while/src:condition
  • while loops with a condition containing the variable i

    //src:while[src:condition//src:name='i']

for statement


Element

  • <for>

Subelements

  • <control>
  • <block>

XPath Queries

  • for loops

    //src:for
  • for-loop initialization statements

    //src:for/src:control/src:init
  • for-loop conditions

    //src:for/src:control/src:condition
  • for-loop increments

    //src:for/src:control/src:incr
  • for loops that declare a variable with a single character name (e.g. x, i or y)

    //src:for[string-length(src:control/src:init/src:decl/src:name)=1]
  • for loops with post-increment in the increment expression

    //src:for[src:control/src:incr/src:expr//following-sibling::src:operator='++']
  • range-based for loops

    //src:for[src:control//src:range]

Examples

for( ;; ) { }
<for>for<control>( <init>;</init><condition>;</condition> <incr/>)</control> <block>{<block_content> </block_content>}</block></for>
for (i = 0; i < max; i++ ) {
    if ( line[i] == ' ' ) {
        space++;
    }
    if ( line[i] == '\t' ) {
        tab++;
    }
}
<for>for <control>(<init><expr><name>i</name> <operator>=</operator> <literal type="number">0</literal></expr>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <name>max</name></expr>;</condition> <incr><expr><name>i</name><operator>++</operator></expr></incr> )</control> <block>{<block_content>
    <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">' '</literal></expr> )</condition> <block>{<block_content>
        <expr_stmt><expr><name>space</name><operator>++</operator></expr>;</expr_stmt>
    </block_content>}</block></if></if_stmt>
    <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">'\t'</literal></expr> )</condition> <block>{<block_content>
        <expr_stmt><expr><name>tab</name><operator>++</operator></expr>;</expr_stmt>
    </block_content>}</block></if></if_stmt>
</block_content>}</block></for>
for (int i = 0; i < 10; ++i)
    a += x[i];
<for>for <control>(<init><decl><type><name>int</name></type> <name>i</name> <init>= <expr><literal type="number">0</literal></expr></init></decl>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <literal type="number">10</literal></expr>;</condition> <incr><expr><operator>++</operator><name>i</name></expr></incr>)</control><block type="pseudo"><block_content>
    <expr_stmt><expr><name>a</name> <operator>+=</operator> <name><name>x</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt></block_content></block></for>
for (int i : v)
    std::cout << i << ' ';
<for>for <control>(<init><decl><type><name>int</name></type> <name>i</name> <range>: <expr><name>v</name></expr></range></decl></init>)</control><block type="pseudo"><block_content>
    <expr_stmt><expr><name><name>std</name><operator>::</operator><name>cout</name></name> <operator>&lt;&lt;</operator> <name>i</name> <operator>&lt;&lt;</operator> <literal type="char">' '</literal></expr>;</expr_stmt></block_content></block></for>

Empty for statement

for (auto  p = v.begin(); p != v.end() && *p != 0; ++p)
    ;
<for>for <control>(<init><decl><type><name>auto</name></type>  <name>p</name> <init>= <expr><call><name><name>v</name><operator>.</operator><name>begin</name></name><argument_list>()</argument_list></call></expr></init></decl>;</init> <condition><expr><name>p</name> <operator>!=</operator> <call><name><name>v</name><operator>.</operator><name>end</name></name><argument_list>()</argument_list></call> <operator>&amp;&amp;</operator> <operator>*</operator><name>p</name> <operator>!=</operator> <literal type="number">0</literal></expr>;</condition> <incr><expr><operator>++</operator><name>p</name></expr></incr>)</control><block type="pseudo"><block_content>
    <empty_stmt>;</empty_stmt></block_content></block></for>

return statement


Element

  • <return>

Subelement

  • <expr>

XPath Queries

  • return statements

    //src:return
  • return expressions

    //src:return/src:expr
  • return statements that return true

    //src:return[src:expr='true']
  • functions with more then one return

    //src:function[count(.//src:return)>1]

switch statement


Element

  • <switch>

Subelements

  • <condition>
  • <block>
  • <case>
  • <default>

XPath Queries

  • switch statements

    //src:switch
  • switch-statement conditions

    //src:switch/src:condition

case statement


Element

  • <case>

Subelement

  • <expr>

XPath Queries

  • case labels

    //src:case
  • case labels that use SATURDAY

    //src:case[.//src:name='SATURDAY']
  • switch statements with a case that uses SATURDAY

    //src:switch[src:block/src:block_content/src:case//src:name='SATURDAY']

Examples

case x:
<case>case <expr><name>x</name></expr>:</case>
case SATURDAY:
<case>case <expr><name>SATURDAY</name></expr>:</case>

default statement


Element

  • <default>

XPath Queries

  • default labels

    //src:default
  • switch statements with a default label

    //src:switch[src:block/src:block_content/src:default]

Example

default:
<default>default:</default>

block


Element

  • <block>

Subelement

  • <block_content>

XPath Queries

  • blocks

    //src:block
  • variable declarations in a block

    //src:block//src:decl_stmt
  • top-level variable declarations in a block

    //src:block/src:block_content/src:decl_stmt

pseudo block


Element

  • <block type="pseudo">

Subelement

  • <block_content>

XPath Queries

  • all pseudo blocks

    //src:block[@type='pseudo']
  • all non pseudo blocks

    //src:block[not(@type='pseudo')]
  • variable declarations in a pseudo block

    //src:block[@type='pseudo']//src:decl_stmt
  • top-level variable declarations in a pseudo block

    //src:block[@type='pseudo']/src:block_content/src:decl_stmt

expression statement


Element

  • <expr_stmt>

Subelement

  • <expr>

XPath Query

  • expression statements

    //src:expr_stmt

label statement


Element

  • <label>

Subelement

  • <name>

XPath Queries

  • labels

    //src:label
  • label names

    //src:label/src:name
  • labels with a goto statement

    //src:label[src:name=//src:goto/src:name]
  • labels without a goto statement

    //src:label[not(src:name[.=//src:goto/src:name])]

Example

stop:
<label><name>stop</name>:</label>

goto statement


Element

  • <goto>

Subelement

  • <name>

XPath Query

  • goto statements

    //src:goto

Example

goto stop;
<goto>goto <name>stop</name>;</goto>

empty statement


Element

  • <empty_stmt>

XPath Query

  • empty statements

    //src:empty_stmt

condition


Element

  • <condition>

Subelement

  • <expr>

XPath Queries

  • conditions, including ternary conditions

    //src:condition
  • condition expressions

    //src:condition/src:expr
  • if conditions

    //src:if/src:condition
  • while conditions

    //src:while/src:condition
  • do while conditions

    //src:do/src:condition
  • ternary conditions

    //src:ternary/src:condition

block content


Element

  • <block_content>

XPath Queries

  • block contents

    //src:block_content
  • declaration block_contents

    //src:decl/src:block/src:block_content
  • function block_contents

    //src:function/src:block/src:block_content

capture


Element

  • <capture>

Subelement

  • <argument>

XPath Queries

  • lambda captures

    //src:capture
  • capture arguments

    //src:capture/src:argument
  • empty captures

    //src:capture[not(src:argument)]
  • captures with this argument

    //src:capture[src:argument/src:name='this']

const


Element

  • <specifier>const</specifier>

XPath Queries

  • const variables

    //src:decl[src:type/src:specifier='const']
  • const function declarations

    //src:function_decl[src:specifier='const']
  • function declarations with a const return type

    //src:function_decl[src:type/src:specifier='const']

static


Element

  • <specifier>static</specifier>

XPath Queries

  • static variables

    //src:decl[src:type/src:specifier='static']
  • static function declarations

    //src:function_decl[src:type/src:specifier='static']

inline


Element

  • <specifier>inline</specifier>

XPath Queries

  • inline function declarations

    //src:function_decl[src:type/src:specifier='inline']
  • inline namespace declarations

    //src:namespace[src:specifier='inline']

volatile


Element

  • <specifier>volatile</specifier>

XPath Query

  • volatile variables

    //src:decl[src:type/src:specifier='volatile']

restrict


Element

  • <specifier>restrict</specifier>

XPath Query

  • variables declarations with the restrict specifier

    //src:decl[src:type/src:specifier='restrict']

auto specifier


Element

  • <specifier>auto</specifier>

XPath Query

  • auto variables

    //src:decl[src:type/src:specifier='auto']

auto type


Element

  • <name>auto</name>

XPath Query

  • variable declarations with auto as their type

    //src:decl[src:type/src:name='auto']

register


Element

  • <specifier>register</specifier>

XPath Query

  • variable declarations with the register specifier

    //src:decl[src:type/src:specifier='register']

extern block


Element

  • <extern>

Subelements

  • <literal type="string">
  • <function_decl>
  • <decl_stmt>
  • <block>

XPath Query

  • extern blocks

    //src:extern

extern specifier


Element

  • <specifier>extern</specifier>

XPath Queries

  • extern variables

    //src:decl[src:type/src:specifier='extern']
  • extern function declarations

    //src:function_decl[src:type/src:specifier='extern']

mutable


Element

  • <specifier>mutable</specifier>

XPath Query

  • mutable variable declarations

    //src:decl[src:type/src:specifier='mutable']

thread_local


Element

  • <specifier>thread_local</specifier>

XPath Query

  • thread_local variable declarations

    //src:decl[src:type/src:specifier='thread_local']

final


Element

  • <specifier>final</specifier>

XPath Queries

  • final function declarations

    //src:function_decl[src:specifier='final']
  • final class definitions

    //src:class[src:specifier='final']

override


Element

  • <specifier>override</specifier>

XPath Query

  • overridden function declarations

    //src:function_decl[src:specifier='override']

virtual


Element

  • <specifier>virtual</specifier>

XPath Query

  • virtual function declarations

    //src:function_decl[src:type/src:specifier='virtual']

r-value reference


Element

  • <ref_qualifier>

XPath Query

  • types with r-value references

    //src:type[.//src:ref_qualifier]

delete specifier


Element

  • <specifier>delete</specifier>

XPath Query

  • deleted function declarations

    //src:function_decl[src:specifier='delete']

default specifier


Element

  • <specifier>default</specifier>

XPath Queries

  • constructors which explicitly use the compiler provided implementation

    //src:constructor_decl[src:specifier='default']
  • functions which explicitly use the compiler provided implementation

    //src:function_decl[src:specifier='default']

explicit


Element

  • <specifier>explicit</specifier>

XPath Query

  • explicit constructor declarations

    //src:constructor_decl[src:specifier='explicit']

template specifier


Element

  • <specifier>template</specifier>

XPath Query

  • names with a template specifier

    //src:name[src:name/src:specifier='template']

variable declaration statement


Element

  • <decl_stmt>

Subelement

  • <decl>

XPath Queries

  • declaration statements

    //src:decl_stmt
  • variable declaration statements with the union qualifier

    //src:decl_stmt/src:decl[contains(src:type,'union')]

variable declaration


Element

  • <decl>

Subelements

  • <name>
  • <init>
  • <index>
  • <block>

XPath Queries

  • variable declarations

    //src:decl
  • variable declarations with an initialization

    //src:decl[src:init]
  • variable declarations with the struct qualifier

    //src:decl[src:type/src:name/src:name='struct']
  • array declarations

    //src:decl[src:name/src:index]
  • array declarations where the number of elements is less than 50

    //src:decl[number(src:name/src:index/src:literal)<50]
  • declaration statements with the uniform initialization syntax

    //src:decl_stmt[contains(src:decl/src:argument_list,'{')]
  • struct declarations with an initialization

    //src:decl[src:init/src:expr/src:block]

Examples

int x;
<decl_stmt><decl><type><name>int</name></type> <name>x</name></decl>;</decl_stmt>
int a = 5;
<decl_stmt><decl><type><name>int</name></type> <name>a</name> <init>= <expr><literal type="number">5</literal></expr></init></decl>;</decl_stmt>
char A[2];
<decl_stmt><decl><type><name>char</name></type> <name><name>A</name><index>[<expr><literal type="number">2</literal></expr>]</index></name></decl>;</decl_stmt>
float matrix[10][15];
<decl_stmt><decl><type><name>float</name></type> <name><name>matrix</name><index>[<expr><literal type="number">10</literal></expr>]</index><index>[<expr><literal type="number">15</literal></expr>]</index></name></decl>;</decl_stmt>
extern char *name[];
<decl_stmt><decl><type><specifier>extern</specifier> <name>char</name> <modifier>*</modifier></type><name><name>name</name><index>[]</index></name></decl>;</decl_stmt>
struct {
    float x, y;
} complex[100];
<struct>struct <block>{
    <decl_stmt><decl><type><name>float</name></type> <name>x</name></decl>, <decl><type ref="prev"/><name>y</name></decl>;</decl_stmt>
}</block> <decl><name><name>complex</name><index>[<expr><literal type="number">100</literal></expr>]</index></name></decl>;</struct>

struct declarations

struct X y;
<decl_stmt><decl><type><name><name>struct</name> <name>X</name></name></type> <name>y</name></decl>;</decl_stmt>

uniform initialization syntax

T x{ arg };
<decl_stmt><decl><type><name>T</name></type> <name>x</name><argument_list>{ <argument><expr><name>arg</name></expr></argument> }</argument_list></decl>;</decl_stmt>

struct initializations

MY_TYPE a = { false, 234, 1.234 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>a</name> <init>= <expr><block>{ <expr><name>false</name></expr>, <expr><literal type="number">234</literal></expr>, <expr><literal type="number">1.234</literal></expr> }</block></expr></init></decl>;</decl_stmt>
MY_TYPE b = (MY_TYPE) { false, 234, 1.234 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>b</name> <init>= <expr><operator>(</operator><name>MY_TYPE</name><operator>)</operator> <block>{ <expr><name>false</name></expr>, <expr><literal type="number">234</literal></expr>, <expr><literal type="number">1.234</literal></expr> }</block></expr></init></decl>;</decl_stmt>
MY_TYPE c = { .flag = true, .value = 123, .stuff = 0.456 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>c</name> <init>= <expr><block>{ <expr><operator>.</operator><name>flag</name> <operator>=</operator> <name>true</name></expr>, <expr><operator>.</operator><name>value</name> <operator>=</operator> <literal type="number">123</literal></expr>, <expr><operator>.</operator><name>stuff</name> <operator>=</operator> <literal type="number">0.456</literal></expr> }</block></expr></init></decl>;</decl_stmt>

function declaration


Element

  • <function_decl>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Queries

  • function declarations

    //src:function_decl
  • function-declaration return types

    //src:function_decl/src:type
  • function-declaration parameters

    //src:function_decl/src:parameter_list/src:parameter
  • function declarations with only two parameters

    //src:function_decl[count(src:parameter_list/src:parameter)=2]
  • function declaration names

    //src:function_decl/src:name
  • function declarations that have variadic arguments

    //src:function_decl[src:parameter_list/src:parameter/src:decl/src:type/src:modifier='...']

Examples

struct STUDENT sortstu( STUDENT a, STUDENT b );
void print(STUDENT a);
<function_decl><type><name><name>struct</name> <name>STUDENT</name></name></type> <name>sortstu</name><parameter_list>( <parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>, <parameter><decl><type><name>STUDENT</name></type> <name>b</name></decl></parameter> )</parameter_list>;</function_decl>
<function_decl><type><name>void</name></type> <name>print</name><parameter_list>(<parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>)</parameter_list>;</function_decl>
void foo (int a[]);
<function_decl><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name><name>a</name><index>[]</index></name></decl></parameter>)</parameter_list>;</function_decl>
void foo (int* a);
<function_decl><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name><modifier>*</modifier></type> <name>a</name></decl></parameter>)</parameter_list>;</function_decl>
int add_multiple_values (int number, ...);
<function_decl><type><name>int</name></type> <name>add_multiple_values</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name>number</name></decl></parameter>, <parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list>;</function_decl>
auto temp() -> int;
<function_decl><type><name>auto</name></type> <name>temp</name><parameter_list>()</parameter_list> -&gt; <type><name>int</name></type>;</function_decl>

function


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath Queries

  • function definitions

    //src:function
  • function-definition return types

    //src:function/src:type
  • function-definition parameters

    //src:function/src:parameter_list/src:parameter
  • function definitions with only two parameters

    //src:function[count(src:parameter_list/src:parameter)=2]
  • function-definition names

    //src:function/src:name
  • function definitions that have variadic arguments

    //src:function[src:parameter_list/src:parameter/src:decl/src:type/src:modifier='...']
  • K & R function definitions

    //src:function[src:decl_stmt]

Examples

struct STUDENT sortstu( STUDENT a, STUDENT b ) {
    struct STUDENT x;
    return x;
}
<function><type><name><name>struct</name> <name>STUDENT</name></name></type> <name>sortstu</name><parameter_list>( <parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>, <parameter><decl><type><name>STUDENT</name></type> <name>b</name></decl></parameter> )</parameter_list> <block>{<block_content>
    <decl_stmt><decl><type><name><name>struct</name> <name>STUDENT</name></name></type> <name>x</name></decl>;</decl_stmt>
    <return>return <expr><name>x</name></expr>;</return>
</block_content>}</block></function>
void print(STUDENT a) { }
<function><type><name>void</name></type> <name>print</name><parameter_list>(<parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
void foo (int a[]) { } 
<function><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name><name>a</name><index>[]</index></name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function> 
void foo (int* a) { }
<function><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name><modifier>*</modifier></type> <name>a</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
int add_multiple_values (int number, ...) { }
<function><type><name>int</name></type> <name>add_multiple_values</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name>number</name></decl></parameter>, <parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
int func(a, b, c)
   int a;
   int b;
   int c;
{ }
<function><type><name>int</name></type> <name>func</name><parameter_list>(<parameter><decl><type><name>a</name></type></decl></parameter>, <parameter><decl><type><name>b</name></type></decl></parameter>, <parameter><decl><type><name>c</name></type></decl></parameter>)</parameter_list>
   <decl_stmt><decl><type><name>int</name></type> <name>a</name></decl>;</decl_stmt>
   <decl_stmt><decl><type><name>int</name></type> <name>b</name></decl>;</decl_stmt>
   <decl_stmt><decl><type><name>int</name></type> <name>c</name></decl>;</decl_stmt>
<block>{<block_content> </block_content>}</block></function>
auto temp() -> int { }
<function><type><name>auto</name></type> <name>temp</name><parameter_list>()</parameter_list> -&gt; <type><name>int</name></type> <block>{<block_content> </block_content>}</block></function>

lambda functions


Element

  • <lambda>

Subelements

  • <capture>
  • <parameter_list>
  • <type>
  • <block>

XPath Queries

  • lambda functions

    //src:lambda
  • lambda functions without a specified return type

    //src:lambda[not(src:type)]
  • lambdas which have a the return type of int

    //src:lambda[src:type/src:name'int']
  • lambda functions which explicitly capture one variable.

    //src:lambda[count(src:capture/src:argument/src:modifier[. != '=' and . != '&']) = 1]
  • lambda functions which capture all variables by reference.

    //src:lambda[src:capture/src:argument/src:modifier='&' and count(src:capture/src:argument)] = 1

Examples

[](int x) { return 0;} 
<expr_stmt><expr><lambda><capture>[]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return></block_content>}</block></lambda></expr></expr_stmt> 
[] { return 0; } 
<expr_stmt><expr><lambda><capture>[]</capture> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return> </block_content>}</block></lambda></expr></expr_stmt> 
[](int x) -> int { return 0;} 
<expr_stmt><expr><lambda><capture>[]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> -&gt; <type><name>int</name></type> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return></block_content>}</block></lambda></expr></expr_stmt> 
[i](int x) { return i; } 
<expr_stmt><expr><lambda><capture>[<argument><name>i</name></argument>]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> <return>return <expr><name>i</name></expr>;</return> </block_content>}</block></lambda></expr></expr_stmt> 
[=](int x) { return 0;} 
<expr_stmt><expr><lambda><capture>[<argument><modifier>=</modifier></argument>]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return></block_content>}</block></lambda></expr></expr_stmt> 
[&](int x) { return 0;} 
<expr_stmt><expr><lambda><capture>[<argument><modifier>&amp;</modifier></argument>]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return></block_content>}</block></lambda></expr></expr_stmt> 
[=](int const& x) mutable { return 0;} 
<expr_stmt><expr><lambda><capture>[<argument><modifier>=</modifier></argument>]</capture><parameter_list>(<parameter><decl><type><name>int</name> <specifier>const</specifier><modifier>&amp;</modifier></type> <name>x</name></decl></parameter>)</parameter_list> <specifier>mutable</specifier> <block>{<block_content> <return>return <expr><literal type="number">0</literal></expr>;</return></block_content>}</block></lambda></expr></expr_stmt> 
[&, =a](int x) { }
<expr><lambda><capture>[<argument><modifier>&amp;</modifier></argument>, <argument><modifier>=</modifier><name>a</name></argument>]</capture><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></lambda></expr>

namespace


Element

  • <namespace>

Subelements

  • <name>
  • <block>

XPath Queries

  • namespaces

    //src:namespace
  • inline namespaces

    //src:namespace[src:specifier='inline']
  • using namespace declarations

    //src:using[src:namespace]
  • namespace assignments

    //src:namespace[count(src:name)>1]
  • anonymous namespace declarations

    //src:namespace[not(src:name)]

Examples

namespace ns { }
<namespace>namespace <name>ns</name> <block>{ }</block></namespace>
inline namespace ns { }
<namespace><specifier>inline</specifier> namespace <name>ns</name> <block>{ }</block></namespace>
namespace ns;
<namespace>namespace <name>ns</name>;</namespace>
using namespace ns;
<using>using <namespace>namespace <name>ns</name>;</namespace></using>
namespace new_name = ns; 
<namespace>namespace <name>new_name</name> = <name>ns</name>;</namespace> 
namespace { }
<namespace>namespace <block>{ }</block></namespace>

using


Element

  • <using>

Subelement

  • <name>

XPath Queries

  • using declarations

    //src:using
  • using namespace declarations

    //src:using[src:namespace]
  • using declarations that import a single item which isn’t a namespace

    //src:using[not(src:namespace) and not(src:template)]
  • templated using declarations

    //src:using[src:template]

typedef


Element

  • <typedef>

Subelements

  • <type>
  • <name>
  • <function_decl>

XPath Queries

  • typedefs

    //src:typedef
  • types in typedefs

    //src:typedef/src:type
  • typedef names

    //src:typedef/src:name
  • typedefs that define a struct

    //src:typedef[src:type/src:struct]
  • typedefs that declare a function type

    //src:typedef[src:function_decl]
  • typedefs of function pointers

    //src:typedef[contains(src:function_decl,')')]
  • names of typedefs of function pointers

    //src:typedef/src:function_decl[contains(.,')')]/src:name

Examples

typedef char C;
typedef unsigned int WORD;
typedef char * pChar;
typedef char field [50]; 
typedef char field, *field2; 
<typedef>typedef <type><name>char</name></type> <name>C</name>;</typedef>
<typedef>typedef <type><name>unsigned</name> <name>int</name></type> <name>WORD</name>;</typedef>
<typedef>typedef <type><name>char</name> <modifier>*</modifier></type> <name>pChar</name>;</typedef>
<typedef>typedef <type><name>char</name></type> <name><name>field</name> <index>[<expr><literal type="number">50</literal></expr>]</index></name>;</typedef> 
<typedef>typedef <type><name>char</name></type> <name>field</name>, <modifier>*</modifier><name>field2</name>;</typedef> 
typedef struct club {
    char name[30];
    int size, year;
} GROUP;
<typedef>typedef <type><struct>struct <name>club</name> <block>{
    <decl_stmt><decl><type><name>char</name></type> <name><name>name</name><index>[<expr><literal type="number">30</literal></expr>]</index></name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>int</name></type> <name>size</name></decl>, <name>year</name>;</decl_stmt>
}</block></struct></type> <name>GROUP</name>;</typedef>
typedef void DRAWF( int, int );
<typedef>typedef <function_decl><type><name>void</name></type> <name>DRAWF</name><parameter_list>( <parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>int</name></type></decl></parameter> )</parameter_list>;</function_decl></typedef>
typedef void (*DRAWF)( int, int );
<typedef>typedef <function_decl><type><name>void</name></type> (<modifier>*</modifier><name>DRAWF</name>)<parameter_list>( <parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>int</name></type></decl></parameter> )</parameter_list>;</function_decl></typedef>

pointer declaration


Element

  • <modifier>*</modifier>

XPath Queries

  • declarations of pointers

    //src:decl[src:type/src:modifier='*']
  • function pointers

    //src:function_decl[contains(.,')')]

Examples

char *message;
<decl_stmt><decl><type><name>char</name> <modifier>*</modifier></type><name>message</name></decl>;</decl_stmt>
int *pointers[10];
<decl_stmt><decl><type><name>int</name> <modifier>*</modifier></type><name><name>pointers</name><index>[<expr><literal type="number">10</literal></expr>]</index></name></decl>;</decl_stmt>
int (*pointer)[10];
<expr_stmt><expr><call><name>int</name> <argument_list>(<argument><expr><operator>*</operator><name>pointer</name></expr></argument>)</argument_list></call><index>[<expr><literal type="number">10</literal></expr>]</index></expr>;</expr_stmt>
int const *x;
<decl_stmt><decl><type><name>int</name> <specifier>const</specifier> <modifier>*</modifier></type><name>x</name></decl>;</decl_stmt>
int(*X)(void);
int(*X)(int, float);
int(*X)(char const*,...);
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>void</name></type></decl></parameter>)</parameter_list>;</function_decl>
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>float</name></type></decl></parameter>)</parameter_list>;</function_decl>
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>char</name> <specifier>const</specifier><modifier>*</modifier></type></decl></parameter>,<parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list>;</function_decl>
int volatile *const z = &some_object;
<decl_stmt><decl><type><name>int</name> <specifier>volatile</specifier> <modifier>*</modifier><specifier>const</specifier></type> <name>z</name> <init>= <expr><operator>&amp;</operator><name>some_object</name></expr></init></decl>;</decl_stmt>
int *const volatile w = &some_object;
<decl_stmt><decl><type><name>int</name> <modifier>*</modifier><specifier>const</specifier> <specifier>volatile</specifier></type> <name>w</name> <init>= <expr><operator>&amp;</operator><name>some_object</name></expr></init></decl>;</decl_stmt>

reference declaration


Element

  • <modifier>amp;</modifier>

XPath Query

  • reference variable declarations

    //src:decl[src:type/src:modifier='&']

rvalue reference


Element

  • <modifier>amp;amp;</modifier>

XPath Query

  • rvalue reference variable declarations

    //src:decl[src:type/src:modifier='&&']

declaration initialization


Element

  • <init>

XPath Queries

  • //src:init
  • array declarations with an initialization

    //src:decl[src:name/src:index][src:init]
  • function declarations with default parameters

    //src:function_decl[src:parameter_list/src:parameter/src:decl/src:init]

Examples

int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
<decl_stmt><decl><type><name>int</name></type> <name><name>myArray</name><index>[<expr><literal type="number">10</literal></expr>]</index></name> <init>= <expr><block>{ <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr>, <expr><literal type="number">5</literal></expr> }</block></expr></init></decl>;</decl_stmt>
int a[6] = { [4] = 29, [2] = 15 };
<decl_stmt><decl><type><name>int</name></type> <name><name>a</name><index>[<expr><literal type="number">6</literal></expr>]</index></name> <init>= <expr><block>{ <expr><index>[<expr><literal type="number">4</literal></expr>]</index> <operator>=</operator> <literal type="number">29</literal></expr>, <expr><index>[<expr><literal type="number">2</literal></expr>]</index> <operator>=</operator> <literal type="number">15</literal></expr> }</block></expr></init></decl>;</decl_stmt>
void point(int x = 3, int y = 4);
<function_decl><type><name>void</name></type> <name>point</name><parameter_list>(<parameter><decl><type><name>int</name></type> <name>x</name> <init>= <expr><literal type="number">3</literal></expr></init></decl></parameter>, <parameter><decl><type><name>int</name></type> <name>y</name> <init>= <expr><literal type="number">4</literal></expr></init></decl></parameter>)</parameter_list>;</function_decl>

bitfield


Element

  • <range>

Subelement

  • <expr>

XPath Query

  • bitfield declarations

    //src:decl[src:range]

operator declaration


Element

  • <function_decl type="operator">

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath Queries

  • operator declarations

    //src:function_decl[@type='operator'] 
  • explicit conversion operator overload declarations

    //src:function_decl[@type='operator'][src:type/src:specifier='explicit']
  • implicit conversion operator overload declarations

    //src:function_decl[@type='operator'][not(src:type)]

operator definition


Element

  • <function type="operator">

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath Queries

  • operator overload definitions

    //src:function[@type='operator']
  • explicit conversion operator overload definitions

    //src:function[@type='operator'][src:type/src:specifier='explicit']
  • implicit conversion operator overload definitions

    //src:function[@type='operator'][not(src:type)]

class definition


Element

  • <class>

Subelements

  • <name>
  • <super_list>
  • <super>
  • <block>

XPath Queries

  • class definitions

    //src:class
  • classes with the name foo

    //src:class[src:name='foo']
  • function definitions in classes

    //src:class//src:function
  • function declarations in classes

    //src:class//src:function_decl

class declaration


Element

  • <class_decl>

Subelement

  • <name>

XPath Query

  • class declarations

    //src:class_decl

Example

class Foo;
<class_decl>class <name>Foo</name>;</class_decl>

inheritance list


Element

  • <super_list>

Subelement

  • <super>

XPath Queries

  • classes with at least one super class

    //src:class[src:super]
  • classes that inherit from bar

    //src:class[src:super/src:name='bar']

public default access specifier


Element

  • <public type="default">

XPath Query

  • function declarations with default public access

    //src:public[@type='default']/src:function_decl

public access specifier


Element

  • <public>

XPath Query

  • public functions

    //src:public/src:function_decl

private default access specifier


Element

  • <private type="default">

XPath Query

  • function declarations with default private access

    //src:private[@type='default']/src:function_decl

private access specifier


Element

  • <private>

XPath Query

  • private members

    //src:private/src:decl_stmt

protected access specifier


Element

  • <protected>

XPath Query

  • protected function declarations

    //src:protected/src:function_decl

protected inheritance specifier


Element

  • <specifier>protected</specifier>

XPath Query

  • classes with protected inheritance

    //src:class[src:super/src:specifier='protected']

private inheritance specifier


Element

  • <specifier>private</specifier>

XPath Query

  • classes with private inheritance

    //src:class[src:super/src:specifier='private']

public inheritance specifier


Element

  • <specifier>public</specifier>

XPath Query

  • classes with public inheritance

    //src:class[src:super/src:specifier='public']

constructor


Element

  • <constructor>

Subelements

  • <name>
  • <parameter_list>
  • <specifier>
  • <member_init_list>
  • <block>

XPath Queries

  • constructors

    //src:constructor
  • constructors with no parameters

    //src:constructor[not(src:parameter_list/src:parameter)]
  • possible default constructors, including constructors with all default parameters

    //src:constructor[src:parameter_list[not(src:parameter)] or (count(src:parameter_list/src:parameter)=count(src:parameter_list/src:parameter/src:decl/src:init))]
  • possible copy constructors, including those which are not defined with the body of class and those with default parameters

    //src:constructor[(src:name|src:name/src:name[last()])=(src:parameter_list/src:parameter[1]/src:decl/src:type/src:name|src:parameter_list/src:parameter[1]/src:decl/src:type/src:name[last()])][((count(src:parameter_list/src:parameter)-1)=count(src:parameter_list/src:parameter/src:decl/src:init))]

Examples

class Point {
    Point() : x(5) {
    }
};
<class>class <name>Point</name> <block>{<private type="default">
    <constructor><name>Point</name><parameter_list>()</parameter_list> <member_init_list>: <call><name>x</name><argument_list>(<argument><expr><literal type="number">5</literal></expr></argument>)</argument_list></call> </member_init_list><block>{<block_content>
    </block_content>}</block></constructor>
</private>}</block>;</class>
Point::Point() : x(5) {
}
<constructor><name><name>Point</name><operator>::</operator><name>Point</name></name><parameter_list>()</parameter_list> <member_init_list>: <call><name>x</name><argument_list>(<argument><expr><literal type="number">5</literal></expr></argument>)</argument_list></call> </member_init_list><block>{<block_content>
</block_content>}</block></constructor>
class Point {
    Point(const Point &x, int y = 1) {
    }
}
<class>class <name>Point</name> <block>{<private type="default">
    <constructor><name>Point</name><parameter_list>(<parameter><decl><type><specifier>const</specifier> <name>Point</name> <modifier>&amp;</modifier></type><name>x</name></decl></parameter>, <parameter><decl><type><name>int</name></type> <name>y</name> <init>= <expr><literal type="number">1</literal></expr></init></decl></parameter>)</parameter_list> <block>{<block_content>
    </block_content>}</block></constructor>
</private>}</block><decl/></class>
Bar::Bar(const Bar& other) {
}
<constructor><name><name>Bar</name><operator>::</operator><name>Bar</name></name><parameter_list>(<parameter><decl><type><specifier>const</specifier> <name>Bar</name><modifier>&amp;</modifier></type> <name>other</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></constructor>
class Bar {
    Bar(Bar&& other) {
    }
}
<class>class <name>Bar</name> <block>{<private type="default">
    <constructor><name>Bar</name><parameter_list>(<parameter><decl><type><name>Bar</name><modifier>&amp;&amp;</modifier></type> <name>other</name></decl></parameter>)</parameter_list> <block>{<block_content>
    </block_content>}</block></constructor>
</private>}</block><decl/></class>
class Point {
    explicit Point(int);
};
<class>class <name>Point</name> <block>{<private type="default">
    <constructor_decl><specifier>explicit</specifier> <name>Point</name><parameter_list>(<parameter><decl><type><name>int</name></type></decl></parameter>)</parameter_list>;</constructor_decl>
</private>}</block>;</class>

constructor declaration


Element

  • <constructor_decl>

Subelements

  • <specifier>
  • <name>
  • <parameter_list>

XPath Query

  • constructor declarations

    //src:constructor_decl

destructor declaration


Element

  • <destructor_decl>

Subelement

  • <name>

XPath Query

  • destructor declarations

    //src:destructor_decl

struct declaration


Element

  • <struct_decl>

Subelement

  • <name>

XPath Query

  • forward struct declarations

    //src:struct_decl

Example

forward declaration

struct employee;
<struct_decl>struct <name>employee</name>;</struct_decl>

struct definition


Element

  • <struct>

Subelements

  • <name>
  • <super_list>
  • <block>

XPath Queries

  • struct definitions

    //src:struct
  • struct members

    //src:struct/src:block/*[self::src:public|self::src:private|self::src:protected]/src:decl_stmt

union declaration


Element

  • <union_decl>

Subelement

  • <name>

XPath Query

  • forward declarations for unions

    //src:union_decl

Example

union X;
<union_decl>union <name>X</name>;</union_decl>

union definition


Element

  • <union>

Subelements

  • <name>
  • <block>

XPath Query

  • union definitions

    //src:union

enum definition


Element

  • <enum>

Subelements

  • <name>
  • <block>

XPath Queries

  • enum definitions

    //src:enum
  • names of members of enums

    //src:enum/src:block/src:decl/src:name

enum declaration


Element

  • <enum_decl>

Subelement

  • <name>

XPath Queries

  • enum declarations

    //src:enum_decl
  • names of enum declarations

    //src:enum_decl/src:name

Example

enum DAY;
<enum_decl>enum <name>DAY</name>;</enum_decl>

enum class


Element

  • <enum type="class">

XPath Query

  • enum class definitions

    //src:enum[@type='class']

enum class declaration


Element

  • <enum_decl type="class">

XPath Query

  • enum class declarations

    //src:enum_decl[@type='class']

new operator


Element

  • <operator>new</operator>

XPath Queries

  • expressions which call new

    //src:operator[.='new']
  • expressions which call array new

    //src:expr[src:operator[.='new']/following-sibling::src:name/src:index]
  • expressions which call no throw new

    //src:expr[src:operator[.='new']/following-sibling::src:name[src:name='nothrow']]

delete operator


Element

  • <operator>delete</operator>

XPath Queries

  • expressions which call delete

    //src:expr[src:operator='delete']
  • expressions which call array delete

    //src:expr[src:operator='delete'][src:index]

ternary operator


Element

  • <ternary>

Subelements

  • <condition>
  • <then>
  • <else>

XPath Query

  • ternary operators

    //src:ternary

operator


Element

  • <operator>

XPath Queries

  • uses of the -> operator

    //src:operator[.='->']
  • uses of the . operator

    //src:operator[.='.']

this


Element

  • <name>this</name>

XPath Query

  • uses of this

    //src:name[.='this']

static cast


Element

  • <cast type="static">

Subelement

  • <argument_list>

XPath Query

  • uses of static cast

    //src:cast[@type='static']

dynamic cast


Element

  • <cast type="dynamic">

Subelement

  • <argument_list>

XPath Query

  • uses of dynamic cast

    //src:cast[@type='dynamic']

reinterpret cast


Element

  • <cast type="reinterpret">

Subelement

  • <argument_list>

XPath Query

  • uses of reinterpret cast

    //src:cast[@type='reinterpret']

static_assert


Element

  • <assert type="static">

Subelement

  • <argument_list>

XPath Query

  • uses of static_assert

    //src:assert[@type='static']

sizeof


Element

  • <sizeof>

Subelement

  • <argument_list>

XPath Query

  • uses of sizeof

    //src:sizeof

sizeof...


Element

  • <sizeof type="pack">

Subelements

  • <argument_list>
  • <name>

XPath Query

  • uses of sizeof…

    //src:sizeof[@type='pack']

typeid


Element

  • <typeid>

Subelement

  • <argument_list>

XPath Query

  • uses of typeid

    //src:typeid

alignof


Element

  • <alignof>

Subelement

  • <argument_list>

XPath Query

  • uses of alignof

    //src:alignof

alignas


Element

  • <alignas>

Subelement

  • <argument_list>

XPath Query

  • uses of alignas

    //src:alignas

attribute


Element

  • <attribute>

Subelement

  • <expr>

XPath Queries

  • attributes

    //src:attribute
  • noreturn functions

    //src:function[src:attribute/src:expr/src:name='noreturn']

asm


Element

  • <asm>

XPath Query

  • uses of asm

    //src:asm

Examples

asm("movl %ebx, %eax");
<asm>asm("movl %ebx, %eax");</asm>
__asm__("movl %ebx, %eax");
<asm>__asm__("movl %ebx, %eax");</asm>
__asm { __asm mov al, 2  __asm mov dx, 0xD007 __asm out dx, al }
<asm>__asm { <asm>__asm mov al, 2</asm>  <asm>__asm mov dx, 0xD007</asm> <asm>__asm out dx, al</asm> }</asm>

template


Element

  • <template>

Subelements

  • <parameter_list>
  • <parameter>
  • <type>

XPath Queries

  • class templates

    //src:class[src:template]
  • function templates

    //src:function[src:template]

Examples

templated class

template<typename T>
class Foo {
};
<class><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T</name></parameter>&gt;</parameter_list></template>
class <name>Foo</name> <block>{<private type="default">
</private>}</block>;</class>

templated function

template<typename T>
void swap(T& lhs, T& rhs);
<function_decl><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T</name></parameter>&gt;</parameter_list></template>
<type><name>void</name></type> <name>swap</name><parameter_list>(<parameter><decl><type><name>T</name><modifier>&amp;</modifier></type> <name>lhs</name></decl></parameter>, <parameter><decl><type><name>T</name><modifier>&amp;</modifier></type> <name>rhs</name></decl></parameter>)</parameter_list>;</function_decl>

partial template specialization

template<typename T>
class Foo<T, void> {

};
<class><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T</name></parameter>&gt;</parameter_list></template>
class <name><name>Foo</name><argument_list type="generic">&lt;<argument><expr><name>T</name></expr></argument>, <argument><expr><name>void</name></expr></argument>&gt;</argument_list></name> <block>{<private type="default">

</private>}</block>;</class>

template member function template

template<typename T1>
template<typename T2>
int string<T1>::compare(const T2& s) { }
<function><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T1</name></parameter>&gt;</parameter_list></template>
<template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T2</name></parameter>&gt;</parameter_list></template>
<type><name>int</name></type> <name><name><name>string</name><argument_list type="generic">&lt;<argument><expr><name>T1</name></expr></argument>&gt;</argument_list></name><operator>::</operator><name>compare</name></name><parameter_list>(<parameter><decl><type><specifier>const</specifier> <name>T2</name><modifier>&amp;</modifier></type> <name>s</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
template<typename T1>
<template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T1</name></parameter>&gt;</parameter_list></template>

template parameters


Element

  • <parameter_list>

Subelement

  • <parameter>

XPath Queries

  • template parameters

    //src:template/src:parameter_list/src:parameter
  • class templates with a template parameter

    //src:class[src:template/src:parameter_list/src:parameter/src:type/src:template]

Examples

typename parameter

template<typename T>
struct Foo { };
<struct><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T</name></parameter>&gt;</parameter_list></template>
struct <name>Foo</name> <block>{<public type="default"> </public>}</block>;</struct>

class parameter

template<class T>
struct Foo { };
<struct><template>template<parameter_list>&lt;<parameter><type><name>class</name></type> <name>T</name></parameter>&gt;</parameter_list></template>
struct <name>Foo</name> <block>{<public type="default"> </public>}</block>;</struct>

default template parameter

template<typename T = Bar>
class Foo { };
<class><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type> <name>T</name> <init>= <expr><name>Bar</name></expr></init></parameter>&gt;</parameter_list></template>
class <name>Foo</name> <block>{<private type="default"> </private>}</block>;</class>

template parameter pack

template<class ... Types> struct Tuple {};
<struct><template>template<parameter_list>&lt;<parameter><type><name>class</name> <modifier>...</modifier></type> <name>Types</name></parameter>&gt;</parameter_list></template> struct <name>Tuple</name> <block>{<public type="default"/>}</block>;</struct>

template template parameter

template<template<typename> class C>
class Foo { };
<class><template>template<parameter_list>&lt;<parameter><type><template>template<parameter_list>&lt;<parameter><type><name>typename</name></type></parameter>&gt;</parameter_list></template> <name>class</name></type> <name>C</name></parameter>&gt;</parameter_list></template>
class <name>Foo</name> <block>{<private type="default"> </private>}</block>;</class>

typename


Element

  • <typename>

XPath Query

  • class templates with a typename in the parameter list

    //src:class[src:template/src:parameter_list/src:parameter/src:type/src:typename]

class type specifier


Element

  • <type>class</type>

XPath Query

  • classes which use class within instead of typename in at least one template parameter

    //src:class[src:template/src:parameter_list/src:parameter/src:type='class']

template parameter pack


Element

  • <modifier>...</modifier>

XPath Query

  • class templates with a template parameter pack

    //src:class[src:template/src:parameter_list/src:parameter/src:type/src:modifier='...']

try


Element

  • <try>

Subelements

  • <block>
  • <catch>
  • <member_init_list>

XPath Queries

  • try block

    //src:try
  • try blocks with at least two catch blocks

    //src:try[count(src:catch)>=2]

Examples

try {
}
<try>try <block>{<block_content>
</block_content>}</block></try>
try {
}
catch { 
}
<try>try <block>{<block_content>
</block_content>}</block>
<catch>catch <block>{<block_content> 
</block_content>}</block></catch></try>
try {
}
catch(Exception e) {
}
<try>try <block>{<block_content>
</block_content>}</block>
<catch>catch<parameter_list>(<parameter><decl><type><name>Exception</name></type> <name>e</name></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></catch></try>
class S {
    S(const std::string& arg) try : m(arg) {
    } catch(const std::exception& e) {
    }
};
<class>class <name>S</name> <block>{<private type="default">
    <constructor><name>S</name><parameter_list>(<parameter><decl><type><specifier>const</specifier> <name><name>std</name><operator>::</operator><name>string</name></name><modifier>&amp;</modifier></type> <name>arg</name></decl></parameter>)</parameter_list> <try>try <member_init_list>: <call><name>m</name><argument_list>(<argument><expr><name>arg</name></expr></argument>)</argument_list></call> </member_init_list><block>{<block_content>
    </block_content>}</block> <catch>catch<parameter_list>(<parameter><decl><type><specifier>const</specifier> <name><name>std</name><operator>::</operator><name>exception</name></name><modifier>&amp;</modifier></type> <name>e</name></decl></parameter>)</parameter_list> <block>{<block_content>
    </block_content>}</block></catch></try></constructor>
</private>}</block>;</class>
int f(int n) try {
} catch(...) {
}
<function><type><name>int</name></type> <name>f</name><parameter_list>(<parameter><decl><type><name>int</name></type> <name>n</name></decl></parameter>)</parameter_list> <try>try <block>{<block_content>
</block_content>}</block> <catch>catch<parameter_list>(<parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list> <block>{<block_content>
</block_content>}</block></catch></try></function>

omp:directive


Element

  • <omp:directive>

Subelements

  • <omp:name>
  • <omp:clause>

XPath Queries

  • omp directives

    //omp:directive
  • omp directives with the name ‘parallel’

    //omp:directive[omp:name='parallel']

omp:name


Element

  • <omp:name>

XPath Query

  • omp names

    //omp:name

omp:clause


Element

  • <omp:clause>

Subelements

  • <omp:name>
  • <omp:argument_list>

XPath Query

  • omp clauses

    //omp:clause

omp:argument_list


Element

  • <omp:argument_list>

Subelement

  • <omp:argument>

XPath Query

  • omp argument lists

    //omp:argument_list

omp:argument


Element

  • <omp:argument>

Subelement

  • <omp:expr>

XPath Query

  • omp arguments

    //omp:argument

omp:expr


Element

  • <omp:expr>

XPath Query

  • omp expressions

    //omp:expr

#define


Element

  • <cpp:define>

Subelements

  • <cpp:directive>
  • <cpp:macro>
  • <cpp:value>

XPath Queries

  • uses of #define

    //cpp:define
  • macro definitions of a macro with the name LENGTH

    //cpp:define[cpp:macro/src:name='LENGTH']
  • macro-definition values

    //cpp:define/cpp:value
  • macro definitions with parameters

    //cpp:define[src:parameter_list]
  • macro-declaration parameter names

    //cpp:define/src:parameter_list/src:parameter
  • variadic macro definitions

    //cpp:define[src:parameter_list//src:modifier='...']

#undef


Element

  • <cpp:undef>

Subelements

  • <cpp:directive>
  • <name>

XPath Queries

  • uses of #undef

    //cpp:undef
  • names of undefined macros

    //cpp:undef/src:name
  • macro names which are both defined and undefined

    //cpp:undef/src:name[.=//cpp:define/src:macro/src:name]

#if


Element

  • <cpp:if>

Subelements

  • <cpp:directive>
  • <expr>

XPath Queries

  • uses of #if

    //cpp:if
  • conditions used by #if

    //cpp:if/src:expr

#ifndef


Element

  • <cpp:ifndef>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • uses of #ifndef

    //cpp:ifndef

#endif


Element

  • <cpp:endif>

Subelement

  • <cpp:directive>

XPath Query

  • uses of #endif

    //cpp:endif

#include


Element

  • <cpp:include>

Subelements

  • <cpp:directive>
  • <cpp:file>

XPath Queries

  • includes

    //cpp:include
  • Names of all included files

    //cpp:include/cpp:file

#pragma


Element

  • <cpp:pragma>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • uses of #pragma

    //cpp:pragma

#error


Element

  • <cpp:error>

Subelements

  • <cpp:directive>
  • <cpp:literal>

XPath Query

  • uses of #error

    //cpp:error

#warning


Element

  • <cpp:warning>

Subelements

  • <cpp:directive>
  • <cpp:literal>

XPath Query

  • uses of #warning

    //cpp:warning

Examples

#warning
<cpp:warning>#<cpp:directive>warning</cpp:directive></cpp:warning>
#warning "Feature not yet supported"
<cpp:warning>#<cpp:directive>warning</cpp:directive> <cpp:literal>"Feature not yet supported"</cpp:literal></cpp:warning>

#line


Element

  • <cpp:line>

Subelements

  • <cpp:directive>
  • <cpp:number>
  • <cpp:file>

XPath Queries

  • uses of #line

    //cpp:line
  • line numbers used by #line directives

    //cpp:line/cpp:number/src:literal
  • #line directives which reference the file “copy.c”

    //cpp:line[cpp:file/src:literal='"copy.c"']

#


Element

  • <cpp:empty>

XPath Query

  • blank preprocessor lines

    //cpp:empty

cpp:directive


Element

  • <cpp:directive>

XPath Query

  • cpp directives

    //cpp:directive

cpp:file


Element

  • <cpp:file>

XPath Query

  • cpp files

    //cpp:file

cpp:number


Element

  • <cpp:number>

XPath Query

  • cpp numbers

    //cpp:number

cpp:literal


Element

  • <cpp:literal>

XPath Query

  • cpp literals

    //cpp:literal

cpp:value


Element

  • <cpp:value>

XPath Query

  • cpp values

    //cpp:value

Examples

#if DLEVEL == 0
    #define STACK 0
#elif DLEVEL == 1
    #define STACK 100
#elif DLEVEL > 5
    display( debugptr );
#else
    #define STACK 200
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><name>DLEVEL</name> <operator>==</operator> <literal type="number">0</literal></expr></cpp:if>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>0</cpp:value></cpp:define>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><name>DLEVEL</name> <operator>==</operator> <literal type="number">1</literal></expr></cpp:elif>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>100</cpp:value></cpp:define>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><name>DLEVEL</name> <operator>&gt;</operator> <literal type="number">5</literal></expr></cpp:elif>
    <expr_stmt><expr><call><name>display</name><argument_list>( <argument><expr><name>debugptr</name></expr></argument> )</argument_list></call></expr>;</expr_stmt>
<cpp:else>#<cpp:directive>else</cpp:directive></cpp:else>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>200</cpp:value></cpp:define>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>
#define WIDTH 80
#define LENGTH ( WIDTH + 10 )
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>WIDTH</name></cpp:macro> <cpp:value>80</cpp:value></cpp:define>
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>LENGTH</name></cpp:macro> <cpp:value>( WIDTH + 10 )</cpp:value></cpp:define>
#define multiply( f1, f2 ) ( f1 * f2 )
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>multiply</name><parameter_list>( <parameter><type><name>f1</name></type></parameter>, <parameter><type><name>f2</name></type></parameter> )</parameter_list></cpp:macro> <cpp:value>( f1 * f2 )</cpp:value></cpp:define>
#define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__)
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>eprintf</name><parameter_list>(<parameter><type><name>format</name></type></parameter>, <parameter><type><modifier>...</modifier></type></parameter>)</parameter_list></cpp:macro> <cpp:value>fprintf (stderr, format, __VA_ARGS__)</cpp:value></cpp:define>