Searching in source cross-reference
Klocwork Static Code Analysis allows you to search for and list entities and attributes of all types, to restrict your search to entities or attributes of a certain type, or to search for specific entity or attribute values.
Static Code Analysis uses both the Entity search criteria and the Attribute search criteria when it performs a search.
It is important to note that since searches are performed in the Klocwork database, Static Code Analysis displays search results based on a project's System model.
If you attempt to view source cross-reference details on an entity returned in a search that does not exist in the model you selected for viewing in source cross-reference, you will see the error message, "The selected entity is not in the current model". To view source cross-reference details on this entity, open the System model instead.
- You do not need to enter anything in the Entity text field, because an asterisk wildcard is entered automatically.
- The search results are limited to 300 rows. You may need to narrow your search criteria to yield a smaller set of more targeted results.
- Only the entity types that are actually in the selected build are shown in the Entity pull-down menu.
- When searching for specific entities, type your specific search criteria: all or part of the name of a specific entity in the source code, or a combination of characters and wildcards, for example: add*, or *error*.
- The search is not case-sensitive.
- A character string can be any number of characters.
- Do not include angle brackets < > around the character string.
- The asterisk (*) is a wildcard. The following examples show how it can be used:
- <character string>: The identifier name ends with the character string.
- <character string>*: The characters in the string can be anywhere inside the identifier name.
- <character string>*: The identifier name starts with the character string.
- <filename>*: Display all entities with this filename.
- If the build contains duplicate entity names, to find all of the entities with that name, use an asterisk at the end. For example, if you want to find all occurrences of tb* in the build, enter the following in the text field: tb*
- If an entity has more than one assigned attribute, it will be displayed more than once in the list.
- When searching for attributes, type your specific attribute search criteria in the attribute field: all or part of the name of a specific attribute value in the source code, or a combination of characters and wildcards. Entering just a wildcard will return all entities of the specified type.
Duplicate entity names
If your project has files with duplicate names in different directories, only one entity is shown in the search results unless you use a wildcard (*). When Klocwork encounters duplicate file names, it appends #<duplicate-number> to the name. For example, there are two duplicate file names in separate directories:
The duplicate file is renamed timestamp.c#1.
A search for timestamp.c will return only the first file. A search for timestamp.c* will return both timestamp.c and timestamp.c#1.