IDE Include Graph Analysis for Platform-Independent Code Suggestions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing programming tools only suggest platform-specific '#include' statements to correct missing definitions, leading to non-standard and platform-dependent code in C-based languages, whereas the goal is to write standard and platform-independent code.

Innovation Solution

A programming tool utilizes an include graph to suggest potential '#include' statements by traversing all paths from the file where the token is defined, stopping when a node belongs to the project, and prioritizing suggestions based on proximity to the project, ensuring that the top-level '#include' statement is suggested for auto-completion, thus maintaining platform independence.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If existing programming tools suggest platform-specific '#include' statements to correct missing definitions, then the token definition can be found, but the code becomes non-standard and platform-dependent

Engineering Contradiction:
Improvetoken definition accuracyVSAvoidplatform independence
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

Instead of suggesting platform-specific headers directly when a token is undefined, the system inverts the approach by analyzing the include graph to identify which platform-specific includes are already present in the project. It then suggests the corresponding standard top-level headers that provide platform-independent access to the same definitions, thereby maintaining reliability while improving platform independence.

Inventive Principle:
Principle #13The other way round (Inversion)

Solution Approach 2:

The system introduces an intermediary analysis layer that examines the project's include graph structure. This intermediary process identifies the relationship between platform-specific headers and their standard counterparts, acting as a mediator that translates the need for platform-specific definitions into suggestions for standard headers, thus resolving the contradiction between finding definitions and maintaining platform independence.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If the system suggests top-level '#include' statements for platform independence, then code remains standard and portable, but existing tools cannot provide accurate suggestions without analyzing the include graph structure

Engineering Contradiction:
Improveplatform independenceVSAvoidanalysis complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system performs preliminary analysis by building and storing the include graph structure in advance, before suggestions are needed. This preliminary action captures the project's header dependencies and relationships, enabling the system to quickly provide accurate suggestions without performing complex analysis at the moment of suggestion, thus reducing the perceived complexity while maintaining platform independence.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system makes the include graph analysis self-serving by automatically utilizing the project's existing include structure to generate suggestions. Rather than requiring manual configuration or complex external analysis tools, the system serves itself by leveraging the already-available include graph data to identify appropriate top-level headers, simplifying the overall process while maintaining accuracy.

Inventive Principle:
Principle #25Self-service

Data Source

PatentEP3365772B1Missing include suggestions for external files
Publication Date: 2021.06.16 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3365772B1 patent drawingFigure 1a~1b
  • EP3365772B1 patent drawingFigure 1c
  • EP3365772B1 patent drawingFigure 1d

AI summary

When writing program code, syntax errors can be detected and a diagnostic error message can be provided. One of the causes of errors in a C-based programming language such as but not limited to C++ is a missing definition. The definition can exist in a file that is separate from the source program file. The file may be designated by a particular statement such as a "#include" statement which points to the file in which the token used in the code is defined. The list of files and their relationships form an include graph. A feature inside an IDE can suggest potential "#include" statements to correct a missing "#include" statement error. By using the include graph a more accurate list of potential corrections can be suggested so that standard and platform independent code can be written.