n South African Computer Journal - Architecting an open system for querying large C and C++ code bases : festschrift : dedicated to Derrick Kourie

Volume 2008, Issue 41
  • ISSN : 1015-7999
  • E-ISSN: 2313-7835



Static code analysis offers a number of tools for the assessment of complexity, maintainability, modularity and safety of industry-size source code bases. Typically, such scenarios include three main phases. First, the code is parsed and 'raw' data is extracted and saved, such as syntax trees, possibly annotated with semantic (type) information. In the second phase, the raw data is queried to check the presence or absence of specific code patterns which supports or invalidates specific claims on the code. In the third and last phase, the query results are presented (visualized) such that correlations between code structure and query results are emphasized in an easily understandable way. Whereas parsing source code is largely standardized, using several existing parsers, querying the outputs of such parsers is still a complex task. The main problem resides in the difficulty of translating high-level, cross-cutting concerns in the problem domain into queries in the raw data domain. We present here an open framework for constructing and executing queries on industry-size C++ code bases. Our query system adds several so-called query primitives atop a exible C++ parser, offers options to combine these primitives into arbitrarily complex expressions, has a highly efficient way to evaluate such expressions on syntax trees of millions of nodes, and presents the query results in a visual, compact, intuitive way. We demonstrate our query framework, integratd in the SolidFX C++ reverse-engineering environment, with several real-world analyses on industrial codebases.

Loading full text...

Full text loading...


Article metrics loading...


This is a required field
Please enter a valid email address
Approval was a Success
Invalid data
An Error Occurred
Approval was partially successful, following selected items could not be processed due to error