outermostOwner( ownerPattern, theCode )

Coverity Documentation

Version
latest

Returns the outermost code that owns the theCode argument that matches the pattern. If the theCode argument matches the pattern, returns theCode itself.

Parameters and return value

Name Type Description
ownerPattern pattern(astnode) -> T The pattern
theCode astnode The code from which the search starts
return value astnode? Returns null if there is no such owner.

Example

C/C++ code follows
if( x + y == 10 ) {      // "code1" is the expression "x"
    x++;                 // "code2" is the expression "x++"
};

In this case, outermostOwner(expression, code1) returns the target code's binary expression x + y == 10, and outermostOwner(expression, code2) returns the target expression x++ itself.