Article thumbnail

Querying Large C and C++ Code Bases: The Open Approach

By Alexandru Telea and Heorhiy Byelas

Abstract

Static code analysis offers a number of tools for the assessment of complexity, maintainability, modularity and safety of industrysize source code bases. Most analysis scenarios include two main phases. First, the code is parsed and ’raw ’ information is extracted and saved, such as syntax trees, possibly annotated with semantic (type) information. In the second phase, the raw information is queried to check the presence or absence of specific code patterns which supports or invalidates specific claims on the code. Whereas parsing source code is largely standardized, and several solutions (parsers) exist already, querying the outputs of such parsers is still a complex task. The main problem resides in the difficulty of easily translating high-level concerns in the problem domain into low-level queries into the raw data domain. We present here an open system for constructing and executing queries on industry-size C++ code bases. Our query system adds several so-called query primitives atop a flexible C++ parser, offers several options to combine these predicates into arbitrarily complex expressions, and has a very efficient way to evaluate such expressions on syntax trees of millions of nodes. We demonstrate the integration of our query system, C++ parser, and interactive visualizations, into the SOLIDFXintegrated environment for industrial code analysis.

Year: 2012
OAI identifier: oai:CiteSeerX.psu:10.1.1.216.9517
Provided by: CiteSeerX

Suggested articles


To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.