Page tree
Skip to end of metadata
Go to start of metadata

On this page:

Target audience:

Users of the extension providing C and C++ analysis support.

Summary: This document provides information about the analysis results you can expect from the analyzer embedded in CAST AIP and the C and Cpp Analyzer extension.

What results can you expect?

Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):

Objects

The following specific objects are detected by the analyzer and can be displayed in CAST Enlighten:

Class

Folder for Classes, Unions and Structures
Dependencies Folder
Globals Folder
File Scope Folder

Constructor

Destructor

Enum

Enum Item

File

Function

Global Variable

Macro

Member

Method

Project

Struct

Class Template

Class Template Specialization

Constructor Template

Constructor Template Specialization

Function Template

Function Template Specialization

Method Template

Method Template Specialization

Subset

Template Parameter

Typedef

Union

CLR Event (Managed C++)

CLR EventAddon (Managed C++)

CLR EventRaise (Managed C++)

CLR EventRemoveOn (Managed C++)

CLR Property (Managed C++)

CLR PropertyGetter (Managed C++)

CLR PropertySetter (Managed C++)

SQL Query

Links

The following is a non-exhaustive list of links that may be identified between objects saved in the CAST Analysis Service:

Link TypeWhen is this type of link used?
ACCESSREAD

Specifies that an object reads a value of another object. For example if a function reads a global variable:

int g_nVar1;
void f()
{
int nVar1 = g_nVar1;
}

C++ Analyzer will generate this Access (Read) link:

WRITE

Specifies that an object modifies another one. For example if a function modifies a global variable:

int g_nVar1;
void f()
{
g_nVar1 = 1;
}

C++ Analyzer will generate this Access (Write) link:

EXEC

Specifies that an object executes another object (method or function). For example if a function calls another function:

void g()
{
f();
}

C++ Analyzer will generate this Access (Exec) link:

Please note that, as a convention, an EXEC link is also used when the definition or declaration of an object invokes a macro. The links is created from the object to the macro.
MEMBER

Specifies that an object accesses a member of another object. For example if a function "g()" accesses a global var "g_pVar" and to one of its members:

struct { int m_n1; }* g_Var;
void g()
{
g_pVar->m_n1 = 1;
}

C++ Analyzer will generate this Access (Member) link:

ARRAY

Specifies that an object accesses another using square brackets ([ ]). For example if a function "g()" accesses a character's array at its first position:

char g_lpBuffer[256];
void g()
{
g_lpBuffer[0] = '\0';
}

C++ Analyzer will generate this Access(Array) link (with the write property also):

BELONG

Represents a parent link between two objects. If "Sample.h" contains the following statement:

class C1
{
public: int foo() {}
};

C++ Analyzer will generate these Belong links:

  • An object always has a "logical" Belong link to its parent (function, class, global variable folder etc.). Furthermore, when the object is defined at the main file level (global variable or function, non-nested class, class method defined at file level), it has a second "physical" link to this implementation file.
  • An object never has more than two parents.
CONTAINDECLARE
This link type occurs between a file and a Global object when there is also a declaration (forward declaration or external declaration) in addition to the definition itself. For example, between a file and a:
  • Class
  • Structure
  • Enum
  • Union
  • Function or method
  • Variable or class member

This link can be seen in the example below (Zc):

DEFINE
This link type occurs when a method is defined outside the file containing the class definition. The link is created from the file containing the method definition to the class. For example, using the code below:

glob.h

extern int theGlobalVariable;
class theClass
{
void method();
};

glob.cpp

/* header comment */
#include "glob.h"
int theGlobalVariable = 3;
void theClass::method()
{ if(2+2==4);
}

C++ Analyzer will generate the following link (Zf):

FRIEND
Specifies that a class or a function is a friend of a class.

For example if the class "C2" is declared as friend of a new "C3" class:

{
//...
friend class C2;
};

C++ Analyzer will generate this Friend link:

INCLUDE

Represents an inclusion link between two files. If the "Sample.cpp" file contains the following statement:

#include "Sample.h"

C++ Analyzer will generate this Include link:

INHERIT-

Represents an inheritance between two classes or structures. If we define a new class "C2" inheriting from C1 as in following statement:

class C2 : public C1
{ int foo() {}
};

C++ Analyzer will generate following Inherit link:

OVERRIDE
Specifies that a method redefines another method from an inherited class. For example using the previous sample, "C2::foo()" redefines "C1::foo()". So C++ Analyzer will generate this link:

RELY ON

Specifies that an object uses an existing type. If we define a new variable of type "C1" in "Sample.cpp":

C1* g_pVar1;

C++ Analyzer will generate following Rely On link :

USE

Represents a link between a C/C++ object and a database object. For example, if we define a function "f_ExecSql" containing a ProC statement referencing the "Authors" table :

void f_ExecSql()
{
EXEC SQL EXECUTE select * from authors where au_id = 0;
}

C++ Analyzer will generate a SQL Query object plus links:


The following ESQL tags are also supported (non exhaustive list):

  • EXEC SQL ... INSERT
  • EXEC SQL ... UPDATE
  • EXEC SQL ... DELETE
  • EXEC SQL ... SELECT
  • EXEC SQL ... CALL
  • EXEC SQL ... DECLARE ... CURSOR FOR
  • EXEC SQL ... EXECUTE ... END-EXEC

In ESQL tags, links to the following objects will be found (non exhaustive list):

  • Tables
  • Views
  • Synonyms
  • Stored Procedures and Functions
  • Package Procedures and Functions (Oracle)
  • No labels