Using the source viewer in Klocwork Static Code Analysis
Using the source viewer in Klocwork Static Code AnalysisThe source viewer is a powerful tool for investigating detected issues in Klocwork Static Code Analysis. It displays source code with line numbers, syntax highlighting, and menus so that you can easily understand and navigate through your source code. Accessing the source viewerThere are two ways you can access the source viewer:
Using the source viewerFunctions in the source viewer are collapsed by default--except of course the one that contains the issue you're viewing. You can expand functions individually or all at once by using the expand or collapse buttons
When assessing detected issues, it's handy to be able to track how an entity, such as a variable, is used across functions or the entire file. The source viewer has a search field in the upper right corner. When you click an unknown (unhyperlinked) entity, such as a variable, your selection automatically populates the search field and each instance is highlighted in orange in the file. Orange markers in the right margin indicate each entity instance in the file. If a whole line of code is highlighted in orange, it indicates that matching instances of the entity are located in the folded function. Expand the function to see additional entity search results. You can navigate to each instance of the entity with these orange markers or with the previous and next arrows next to the search field. Entity highlighting in the Source Viewer works only for single words. Multi-word entity search highlighting is not supported. Tip: A + symbol in the search field indicates a full word match search.
Red markers indicate detected issues in the current file: Note: These red markers will not appear in the Source-Cross Reference source viewer.
Types (such as char, int, class, and this) and keywords (such as const, static, return, while, and if) appear in dark blue. Preprocessor directives such as includes and defines are in dark red. Click the green include file link to navigate to the file. Investigating known entity identifiersKnown entity identifiers (such as file and class identifiers) appear in blue. Clicking the blue text opens a pop-up menu: Options in the pop-up menu allow you to:
|