Skip to main content

cpp_alias_declaration_target_text

Function cpp_alias_declaration_target_text 

Source
pub fn cpp_alias_declaration_target_text(declaration: &str) -> Option<String>
Expand description

Text of the type that a C or C++ alias declaration names, read from the type_definition or alias_declaration node’s type field.

The declaration text is never scanned. A function-pointer typedef interleaves its aliased type with its declarator (typedef R (*F)(int)), so no prefix or suffix of the spelling isolates the target.

An alias whose declarator is a function declarator names a function type: typedef R F(int), typedef R (*F)(int), typedef R *F(int), and using F = R (*)(int). The analyzer’s type model names declared types only, so such an alias has no canonical target. Its type field holds the return type R, which is a different type from the alias, so this returns None rather than that return type.