Skip to content

feat(cpp): add C/C++ language translation, scan context, and base method visitor#408

Open
Divyateja2709 wants to merge 14 commits into
cbomkit:mainfrom
Divyateja2709:pr7
Open

feat(cpp): add C/C++ language translation, scan context, and base method visitor#408
Divyateja2709 wants to merge 14 commits into
cbomkit:mainfrom
Divyateja2709:pr7

Conversation

@Divyateja2709
Copy link
Copy Markdown

Description:
This PR adds the first three engine interface implementations for C/C++ language support. These are pure translation and context classes with no dependencies on each other, making them easy to review independently.Files added in engine/src/main/java/com/ibm/engine/language/cpp/:

  • CppScanContext.java — fills the P generic slot. Wraps SonarQube's SensorContext and InputFile to report issues directly via the sensor API, same approach as C#.
  • CppLanguageTranslation.java — implements ILanguageTranslation. Extracts method names, object type strings, and argument lists from CppMethodInvocationTree nodes. Since ANTLR4 has no type inference, all parameter types match any expected type.
  • CppBaseMethodVisitor.java — implements IBaseMethodVisitor. When the sensor hands it a CppBlockTree (a function body), it runs the detection engine on it.

Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
Signed-off-by: Divyateja Indrakanti <indrakantidivyateja@gmail.com>
@Divyateja2709 Divyateja2709 requested a review from a team as a code owner May 10, 2026 03:17
@san-zrl
Copy link
Copy Markdown
Contributor

san-zrl commented May 20, 2026

Hi @Divyateja2709,

Thank you for your PR and for the time and effort you put into contributing to CBOMkit—we truly appreciate your interest.

You may have noticed that we are already working on adding C/C++ support to sonar-cryptography in PR #377. This approach differs from yours, as it relies on Sonar’s native C/C++ support package rather than ANTLR, similar to how the existing Java module is implemented.

Work on PR #377 is already quite advanced, and at this stage we are leaning toward this approach because we expect it to provide stronger support for cross-file symbol tracing through the Sonar infrastructure.

That said, we will keep your PR open for now until a final decision is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants